Float and word order converter

Enter two registers as read from a device, and compare all four byte and word orders. Or enter a number to see the registers a device would send.

Orderfloat32uint32int32
ABCD123.45611234778811123477881
CDAB-1.88337e+253917038326-377928970
BADC-9.86112e+324131551721-163415575
DCBA1.51850e+3520453760662045376066
OrderRegisters (hex)Registers (decimal)
ABCD42F6 E97917142 59769
CDABE979 42F659769 17142
BADCF642 79E963042 31209
DCBA79E9 F64231209 63042

Runs in your browser. The values you type stay on your device.

Worked example: 123.456 in four orders

As an IEEE 754 float, 123.456 is the four bytes 42 F6 E9 79. A device can put those bytes into two registers in four common ways, and the table above shows each one. Read 42F6 E979 as CDAB and you get -1.88337e+25 instead of 123.456.

Reading 32-bit floats over Modbus explains how to find the right order on a device you don't have a manual for.

Questions

What does CDAB mean in Modbus?

It names the byte order of a 32-bit value spread over two registers. A and B are the two most significant bytes. In CDAB the register holding the low bytes comes first, a layout often called word swap.

Why does my float read as a huge number or a tiny one?

The device and your software disagree about word order. Decoded as CDAB, the registers of 123.456 turn into -1.88e+25. Try all four orders with the same two registers and pick the one that gives a sane value.

Is there a standard word order?

No. The Modbus specification defines 16-bit big-endian registers and says nothing about how to combine them into 32-bit values, so each vendor picks. Check the device manual, then confirm with a value you know.