Menu

Byte Order and Endianness Reference

Reference guide for byte order and endianness covering big-endian vs little-endian values, multi-register data, and the relationship to word order.

Categories:

Overview

Byte order, or endianness, defines how bytes are arranged inside a multi-byte value. In industrial protocols such as Modbus, this matters any time a value is larger than 8 bits.

The practical reason this deserves its own reference page is simple: many field issues described as scaling problems or bad data are actually byte-order or word-order mismatches.

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 separate ordering decisions:

  • Byte order inside each 16-bit word
  • Word order across the 16-bit words

That is why one device can expose a perfectly valid FLOAT32 value that still looks wrong unless both byte and word order are configured correctly.

How To Diagnose It

  1. Read the raw value from the device.
  2. Decode the value using the plausible byte and word-order combinations.
  3. Compare the decoded result to a known physical measurement.
  4. Keep the combination that matches the real-world value.

Common Problems

  • 32-bit float looks wildly wrong even though the address is correct
  • Value only makes sense when registers are reversed
  • Scaling is blamed when the real fault is byte or word order