Modbus Float Converter

Convert IEEE 754 float values to/from two Modbus holding registers. Supports big-endian and little-endian word orders.

Modbus float IEEE 754 register word endian ABCD CDAB

Input values

Enter values and click Calculate to see results here.

Formula

Float (IEEE 754) = 32-bit: sign(1) + exponent(8) + mantissa(23) AB/CD (big-endian): RegN = high word, RegN+1 = low word CD/AB (little-endian): RegN = low word, RegN+1 = high word

Worked Example

Given: A float value 25.5, and you need the register values for AB/CD word order.

Step 1: 25.5 in IEEE 754 = 0x41C80000

Step 2: AB/CD: High word = 0x41C8, Low word = 0x0000

Step 3: Holding registers: Reg[0] = 16872 (0x41C8), Reg[1] = 0 (0x0000)

If reading back gives a wrong value, your device may use CD/AB word order. Swap the registers.

Engineering Notes

  • Word order problem: This is the #1 cause of wrong Modbus float readings. If you see very large or very small numbers, the word order is probably swapped.
  • AB/CD (big-endian): Most common. High word first, low word second. Used by Modbus standard.
  • CD/AB (little-endian): Low word first, high word second. Some PLCs and devices use this.
  • AB/BA and CD/DC: Rare byte-swapped variants. If neither AB/CD nor CD/AB works, try byte-swapping within each word.
  • Debugging: Read a known value (e.g., 1.0 = 0x3F800000) and check the raw register values to determine the word order.

References

  • IEEE 754 — Floating-point arithmetic
  • MODBUS Application Protocol Specification V1.1b3