Modbus protocol reference

Modbus Byte Order Explained: Big-Endian, Little-Endian & Word Swap

Reading a 32-bit float and getting a nonsense number? It's almost always a byte or word order mismatch. Here's how Modbus byte order actually works, and how to find the right setting for your device.

Quick take: A single 16-bit Modbus register is always big-endian (high byte first). The problem is multi-register values — 32-bit integers, floats, 64-bit doubles — where vendors disagree on which register comes first and whether the bytes inside each register are swapped.

Why byte order matters in Modbus

The Modbus protocol only formally defines how a single 16-bit register is transmitted: the high-order byte first, then the low-order byte. That part is fixed by the spec and every device follows it.

The trouble starts when a value needs more than 16 bits — a 32-bit integer, a 32-bit IEEE-754 float, or a 64-bit double. These are stored across two or four consecutive registers, and the Modbus specification does not define which register holds the most significant bits. Every PLC, energy meter, and VFD vendor made its own choice, so your master application has to match whatever the device does — or you'll read back the wrong number entirely.

The four common layouts (ABCD, BADC, CDAB, DCBA)

Engineers commonly describe 32-bit register layouts using four letters, where A is the most significant byte and D is the least significant byte of the original value:

LayoutByte orderWord orderAlso called
ABCDBig-endianHigh word firstBig-endian / normal
DCBALittle-endianLow word firstLittle-endian / swapped
BADCLittle-endian bytesHigh word firstMid-big-endian
CDABBig-endian bytesLow word firstWord-swapped / mid-little-endian

CDAB (word swap, big-endian bytes) is especially common on Schneider, ABB, and many energy meter register maps, so it's worth checking first if a value looks scaled wrong or wildly incorrect.

Symptoms of a byte order mismatch

How to find the right byte order for your device

  1. Check the vendor's Modbus register map / communication manual — most document byte order explicitly, sometimes as "word order" or "swap" in the register table notes.
  2. If undocumented, write a known value (e.g., 100.0 as a float, or 123456 as a 32-bit integer) into the register pair using a simulator or the device's own configuration tool.
  3. Read the raw two registers back and try decoding them under each of the four orderings until one produces the expected value.
  4. Lock that ordering into your master application or SCADA driver configuration so every future read/write decodes consistently.

Testing byte order with a simulator

Instead of guessing against a live PLC or energy meter — where a wrong write can affect a real process — you can reproduce the same register pair in a Modbus slave simulator and try each layout safely. Set a holding register pair to a known float or 32-bit integer, choose ABCD/BADC/CDAB/DCBA on the simulator side, and confirm what your master application decodes. Once it matches, you know the exact configuration to apply against the real device.

Related pages

Test byte order without touching live hardware

Set exact register values and byte/word order in ModbusSimulator, then verify your master application decodes them correctly.

Download Free tier

FAQ

Is Modbus big-endian or little-endian?

Within a single 16-bit register, Modbus is big-endian (high byte first) — that part is fixed by the spec. For values spanning multiple registers, the order is vendor-specific.

What is Modbus word swap?

Word swap describes whether the register with the most significant 16 bits of a 32-bit value is sent first (normal) or second (swapped, often called CDAB).

What do ABCD, BADC, CDAB and DCBA mean?

They describe byte layout across two registers for a 32-bit value, where A is the most significant byte and D is the least significant. Each letter combination represents a different byte/word order combination used by different vendors.

How do I find the correct byte order for my device?

Check the vendor's register map documentation first. If it's not documented, write a known test value and try decoding it under each common ordering until the result matches.

Can a simulator help debug byte order issues?

Yes. A simulator lets you set register pairs to known values under each byte/word order so you can confirm your master application's decoding logic before connecting to the real device.