Industrial Networks and OT · #86

Online Modbus Byte and Word Order Decoder

Finds which byte/word order gives the right value by showing all possibilities side by side.

  • Data is processed in your browser and not sent to a server

Tool

Separate with space, comma or ;; 0x for hex.

For encode mode.

To find the right order when decoding; optional.

What does this tool do?

Modbus registers are 16 bits; a 32-bit float or integer spans two registers, 64-bit values four. Vendors order the parts differently (big endian ABCD, word swap CDAB, byte swap BADC, little endian DCBA). If SCADA shows '4.2e−41' instead of '12.5', the order is wrong. The tool shows all four orders at once and marks the right one if you enter the expected value.

How to use it

  1. In decode mode enter the registers in decimal or 0x hex separated by spaces and choose the data type.
  2. Enter the true value you know in 'Expected value' (e.g. temperature on the panel).
  3. In encode mode enter a value to get the registers to write in each order.

Fields

Mode
Data type
Register values
Separate with space, comma or ;; 0x for hex.
Value
For encode mode.
Expected value
To find the right order when decoding; optional.

Worked example

InputValue
ModeRegisters → value (decode)
Data typeFloat 32-bit (2 registers)
Register values0x4148 0x0000
Expected value12.5

Expected result: 0x4148 0x0000 → 12.5 in ABCD order (matches the expected value); the other orders give meaningless values (e.g. 2.3e-41 or 197,632).

The device sends big endian (ABCD); 'word swap' must be off in the SCADA tag. Confirm with at least one more value at a different reading (e.g. 0 and 100).

Second scenario

InputValue
ModeValue → registers (encode)
Data typeFloat 32-bit (2 registers)
Value12.5

Expected result: The value 12.5 is written as 0x4148 0x0000 in ABCD, 0x0000 0x4148 in CDAB, 0x4841 0x0000 in BADC and 0x0000 0x4841 in DCBA.

Method and assumptions

Registers are turned into a big-endian byte array (register 1 = A B, register 2 = C D …). Each order rearranges these bytes and reads them as IEEE 754 float or two's complement integer. Negative decimal register values (−32768…−1) are taken as 16-bit two's complement.

Using the result and troubleshooting

Transfer the order found to the SCADA/PLC driver's 'byte swap', 'word swap' or 'endianness' setting. Use the Modbus Register Address Converter to make sure the address is right.

Limits and common mistakes

  • 64-bit integers, BCD, strings and scaled values (e.g. ×0.1) are not decoded; apply the scale to the result separately.

Frequently asked questions

What is the difference between CDAB and BADC?

CDAB reverses the register order (word swap) while bytes inside each register stay; BADC keeps register order but swaps the two bytes inside each register (byte swap).

Related tools and service

Related service: PLC–PLC and PLC–Server Integration

Industrial online tools · See all online tools