Inferensys

Glossary

UA Binary Encoding

A compact, high-performance serialization format defined by OPC UA that encodes data structures into a binary stream for efficient transport over TCP or other protocols.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
OPC UA SERIALIZATION FORMAT

What is UA Binary Encoding?

UA Binary Encoding is a compact, high-performance serialization format defined by the OPC UA specification that encodes data structures into a binary stream for efficient transport over TCP or other protocols.

UA Binary Encoding is the native, high-performance serialization mechanism defined by the OPC UA specification for encoding data structures into a compact binary stream. It directly maps the fields of a Structure or DataSet into a sequential byte layout according to a predefined schema, eliminating the verbosity of text-based formats like JSON Encoding. This encoding is mandatory for the UA-TCP transport and is optimized for minimal payload size and maximum processing speed, making it ideal for high-throughput industrial automation scenarios where bandwidth and CPU cycles are constrained.

The encoding process relies on the OPC UA type system and the structure's DataTypeDefinition to serialize each field in order, using specific rules for built-in types like Int32, Float, and String. For complex types, it recursively encodes nested structures. The resulting binary stream is then wrapped in a NetworkMessage for transport. Because both the sender and receiver share the same Information Model and schema, deserialization is a direct, zero-copy mapping of bytes back into memory, enabling deterministic, low-latency data exchange critical for Pub-Sub and Client-Server interactions.

HIGH-PERFORMANCE SERIALIZATION

Key Features of UA Binary Encoding

UA Binary Encoding is the compact, high-speed wire format that makes OPC UA viable for bandwidth-constrained industrial networks and real-time control loops. It translates the structured data of the OPC UA Address Space into an optimized binary stream for transport over TCP and other protocols.

01

Compact Data Representation

UA Binary uses a tag-length-value structure that eliminates the verbose markup of text-based formats. Integer and floating-point values are stored in their native binary form, while strings are prefixed with their byte length. This avoids delimiters and reduces payload size by up to 80% compared to XML-based encodings, making it ideal for high-frequency sensor data streams.

02

Optimized for TCP Transport

The encoding is designed to map directly onto TCP-based OPC UA connections (opc.tcp://). Binary messages are framed within the OPC UA Secure Conversation protocol, which handles chunking, signing, and encryption. This tight coupling minimizes serialization overhead and enables sub-millisecond encoding/decoding on resource-constrained industrial controllers.

03

Built-in Type System Mapping

Every OPC UA Built-in Type has a deterministic binary representation defined in the specification. Complex structures, arrays, and nested objects are serialized recursively without ambiguity. This eliminates the need for external schema documents during decoding, as the type information is either known from the Address Space or embedded in the stream via NodeId and EncodingMask fields.

04

Endianness and Alignment Rules

UA Binary enforces little-endian byte ordering for all multi-byte values, matching the native format of x86 and ARM processors common in industrial hardware. Fields are packed without padding, maximizing density. This hardware-aligned design allows direct memory mapping of received buffers to C/C++ structures, avoiding costly byte-swapping operations during parsing.

05

Streaming and Chunking Support

Large data structures, such as historical event logs or firmware images, are automatically segmented into MessageChunks at the transport layer. Each chunk carries a sequence header, allowing the receiver to reassemble the original payload. This streaming model prevents memory exhaustion on embedded devices and enables progressive processing of partial data.

06

Interoperability with JSON Encoding

OPC UA defines both UA Binary and UA JSON as standard encodings. A server can expose the same Variable Node via both formats on different endpoints. This allows a factory-floor PLC to communicate with a SCADA system using compact binary over TCP, while simultaneously feeding a cloud analytics pipeline using human-readable JSON over WebSockets or MQTT.

SERIALIZATION FORMAT COMPARISON

UA Binary vs. JSON Encoding

A technical comparison of the two primary OPC UA data encoding formats, evaluating their suitability for different industrial communication scenarios.

FeatureUA BinaryJSONXML

Human Readability

Payload Size (typical)

1x (baseline)

3-5x larger

6-10x larger

Encoding Speed

Fastest

Moderate

Slowest

Decoding CPU Overhead

Minimal

Moderate

High

Native Web Compatibility

Firewall Traversal Ease

Moderate (TCP)

Easy (HTTP/WebSocket)

Easy (HTTP/HTTPS)

Schema Validation

Built-in (Type System)

External (JSON Schema)

Built-in (XSD)

Primary Transport Binding

UA TCP

HTTPS / WebSocket

SOAP/HTTP

UA BINARY ENCODING

Frequently Asked Questions

Common questions about OPC UA's compact, high-performance serialization format for industrial data exchange.

UA Binary Encoding is a compact, high-performance serialization format defined by the OPC UA specification that converts structured data into an optimized binary stream for efficient transport over TCP or other protocols. It works by serializing each field of an OPC UA data structure sequentially according to a predefined type system, using little-endian byte ordering and minimal overhead. Unlike text-based formats such as JSON or XML, UA Binary Encoding uses fixed-size representations for primitive types (integers, floats, booleans) and length-prefixed structures for variable-length fields like strings and arrays. The encoding preserves the hierarchical structure of complex types while eliminating the verbosity of human-readable formats, resulting in significantly smaller message sizes and faster parsing. This makes it the preferred encoding for high-throughput, low-latency industrial communication where bandwidth and processing power may be constrained on embedded devices and PLCs.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.