Modbus Float Converter
Decode 2 or 4 Modbus registers as IEEE 754 float32/float64 or int32/uint32, and back. Compare ABCD, CDAB, BADC and DCBA byte orders in one table.
Registers → value
| Order | Value bytes (most significant first) | float32 | int32 | uint32 |
|---|---|---|---|---|
| ABCD Big-endian (high word first) | ||||
| CDAB Word swap (low word first) | ||||
| BADC Byte swap (bytes swapped in each register) | ||||
| DCBA Little-endian (words and bytes swapped) |
The row that matches the value on the device display or in the manual is the device's order.
Value → registers
| Order | Registers (HEX) | Registers (decimal) |
|---|---|---|
| ABCD Big-endian (high word first) | ||
| CDAB Word swap (low word first) | ||
| BADC Byte swap (bytes swapped in each register) | ||
| DCBA Little-endian (words and bytes swapped) |
Everything is computed in your browser; nothing you type is sent anywhere.
Why the order differs between devices
The Modbus specification only defines a register as 16 bits sent high byte first (Modbus Application Protocol Specification V1.1b3, section 4.2). It does not say how a 32-bit or 64-bit value is split across several registers.
So some devices put the high word at the lower address (ABCD), others put the low word first (CDAB), and some also swap the bytes inside each register (BADC, DCBA). It can vary by model or setting even from the same maker.
Finding it in the manual
- In the register table of the communication manual, look for the data type (Float, REAL, 32-bit floating point) and words such as "word order", "byte order", "high word first" or "swap".
- Some devices let you choose the order in a setup menu. Check the communication settings too.
- If it is not documented, read a value you already know, such as a temperature or voltage on the display, and pick the row above that shows it. Zero and whole numbers can look similar in several orders, so confirm with a value that has decimals.
A 32-bit value must be read as two consecutive addresses in one request (quantity 2). If the address is off by one you get half of another value, so check 40001 notation vs 0-based addresses as well. You can build the read request with the Modbus RTU Request Builder.
FAQ
What is 41C8 0000?
Read as ABCD it is 25.0. IEEE 754 binary32 has 1 sign bit, 8 exponent bits (bias 127) and 23 fraction bits. 0x41C80000 has sign 0, exponent 131 (2⁴) and significand 1.5625, so 1.5625 × 16 = 25.
I get tiny (around 1E-38) or huge numbers
That is a typical sign of the wrong order. Look at the other rows. If no row makes sense, check that the start address is not off by one.
How do I read a float64 (double)?
Enter four registers to decode float64, int64 and uint64. The same rules are applied to 64 bits: CDAB reverses the order of all four registers and BADC swaps the bytes in each register. Some devices may use another layout, so check the manual.
I get NaN or Infinity
In IEEE 754, an exponent with all bits set means infinity when the fraction is zero and NaN otherwise. Either the order is wrong or the device sent it on purpose; see the manual for its error-value rules.
To read the registers from a device directly, use PortDock Modbus Master.