Byte Order - Knowledge Base

Byte order (endianness) overview covering big-endian vs little-endian, multi-register data, and the relationship to word order.

Categories:

What Byte Order Is

Byte order (endianness) defines the arrangement of bytes within a multi-byte value. In Modbus and other industrial protocols, the source and destination devices must agree on byte order for values larger than 8 bits.

Big-Endian vs Little-Endian

OrderByte Layout (16-bit)Also Called
Big-endianMost significant byte firstNetwork byte order
Little-endianLeast significant byte firstIntel byte order

For a 16-bit value 0x0102:

  • Big-endian: 01 02
  • Little-endian: 02 01

Byte Order vs Word Order

For 32-bit and 64-bit values spanning multiple registers, there are two independent ordering layers:

  • Byte order — arrangement of bytes within each 16-bit word
  • Word order — arrangement of 16-bit words within the multi-word value

This creates four possible combinations, all of which appear in real devices.

[!WARNING] Most field issues labeled as “bad scaling” or “wrong data” are actually endianness mismatches. Always validate with a known-good engineering value.

How to Determine Byte Order

  1. Read the raw bytes from the device
  2. Decode the value in both byte orders
  3. Compare to a physically verifiable measurement
  4. The order producing the correct value is the device’s byte order

Common Problems

  • Values are wildly wrong or appear scrambled — Byte or word order mismatch between the source device and the gateway. This is almost never a scaling error. See Modbus Data Types & Byte Order Reference to identify the correct combination.
  • 32-bit float reads as garbage — The gateway is configured with the wrong word order for the FLOAT32 value. The device may use big-endian words with little-endian bytes (or any other combination). See Modbus Data Types & Byte Order Reference.
  • Value only correct when reading as two separate 16-bit registers — The multi-register data type is enabled but word order is inverted. See Word Order - Knowledge Base.

Need more help?

If this page does not resolve the issue, contact Chipkin support with the product model, protocol details, and any diagnostics you have already captured.

Open Chipkin Support