You are offline. The tools work from the copy saved in this browser; pages you have not opened yet need a connection.
IEEE 754 Float Converter
Type a number, hex or bits. You get the Float32 and Float64 bit patterns, the exact value the computer stores, how much it was rounded and the registers for every byte order.
Number
ExampleDecimal: 230.5, -1.5e-3, inf, nan (a decimal comma works too). Hex: 8 digits for Float32, 16 for Float64; two or four registers such as 4366 8000 work as well. Binary: 32 or 64 bits.
Float32 (single precision, REAL)
| Value (shortest form) | |
|---|---|
| Exact stored value | |
| Rounding error | |
| Hex | |
| Kind | |
| Sign | |
| Exponent | |
| Significand | |
| Formula | |
| Step to the next value |
Bits
signexponentfraction (mantissa)
Tap a bit to flip it. The input switches to hex, so you see the new pattern and can copy it.
Modbus registers
| Order | Hex | Decimal |
|---|
Float64 (double precision, LREAL)
| Value (shortest form) | |
|---|---|
| Exact stored value | |
| Rounding error | |
| Hex | |
| Kind | |
| Sign | |
| Exponent | |
| Significand | |
| Formula | |
| Step to the next value |
Bits
signexponentfraction (mantissa)
Tap a bit to flip it. The input switches to hex, so you see the new pattern and can copy it.
Modbus registers
| Order | Hex | Decimal |
|---|
Runs entirely in your browser. Nothing you enter is sent to a server.
Common values in hex
Typical Modbus readings converted to Float32 and Float64. ABCD is the hex as written (big-endian), CDAB the same two registers swapped, the most common other order.
| Value | Float32 ABCD | Float32 CDAB | Float64 |
|---|---|---|---|
| 0.01 | 3C23D70A | D70A 3C23 | 3F847AE147AE147B |
| 0.5 | 3F000000 | 0000 3F00 | 3FE0000000000000 |
| 1.5 | 3FC00000 | 0000 3FC0 | 3FF8000000000000 |
| 2.0 | 40000000 | 0000 4000 | 4000000000000000 |
| 5.0 | 40A00000 | 0000 40A0 | 4014000000000000 |
| −5.0 | C0A00000 | 0000 C0A0 | C014000000000000 |
| 10.0 | 41200000 | 0000 4120 | 4024000000000000 |
| 12.5 | 41480000 | 0000 4148 | 4029000000000000 |
| 20.0 | 41A00000 | 0000 41A0 | 4034000000000000 |
| 25.0 | 41C80000 | 0000 41C8 | 4039000000000000 |
| 50.0 | 42480000 | 0000 4248 | 4049000000000000 |
| 60.0 | 42700000 | 0000 4270 | 404E000000000000 |
| 100.0 | 42C80000 | 0000 42C8 | 4059000000000000 |
| 230.0 | 43660000 | 0000 4366 | 406CC00000000000 |
| 230.5 | 43668000 | 8000 4366 | 406CD00000000000 |
| 400.0 | 43C80000 | 0000 43C8 | 4079000000000000 |
| 1000.0 | 447A0000 | 0000 447A | 408F400000000000 |
| 1000.5 | 447A2000 | 2000 447A | 408F440000000000 |
Special values
Bit patterns worth recognising when you read raw registers. The value is under each pattern.
| Value | Float32 | Float64 |
|---|---|---|
| Zero | 000000000 | 00000000000000000 |
| Negative zero | 80000000-0 | 8000000000000000-0 |
| One | 3F8000001 | 3FF00000000000001 |
| Minus one | BF800000-1 | BFF0000000000000-1 |
| 0.1 (nearest value) | 3DCCCCCD0.1 | 3FB999999999999A0.1 |
| Largest whole number with no gaps below it (2^24 / 2^53) | 4B80000016777216 | 43400000000000009007199254740992 |
| Smallest positive (subnormal) | 000000011e-45 | 00000000000000015e-324 |
| Smallest normal | 008000001.1754944e-38 | 00100000000000002.2250738585072014e-308 |
| Largest finite | 7F7FFFFF3.4028235e+38 | 7FEFFFFFFFFFFFFF1.7976931348623157e+308 |
| Infinity | 7F800000Infinity | 7FF0000000000000Infinity |
| Minus infinity | FF800000-Infinity | FFF0000000000000-Infinity |
| NaN (quiet) | 7FC00000NaN | 7FF8000000000000NaN |
How IEEE 754 stores a number
A floating-point number is three fields packed into 32 or 64 bits. The sign bit says plus or minus. The exponent (8 bits in Float32, 11 in Float64) says by which power of two to multiply. It is stored with an offset (bias) of 127 or 1023, so 134 means 2^7. The fraction (23 or 52 bits) holds the binary digits after the leading 1, which itself is not stored. Value = (−1)^sign × 1.fraction × 2^(exponent − bias).
Most decimal fractions have no exact binary form. The converter shows the nearest value the format can hold, with every digit, and how far it is from what you typed. It rounds your decimal straight to each format, so the result is correct even in the rare cases where going through Float64 first would land one step off. An exponent of all zeros means zero or a subnormal number; all ones means infinity or NaN.
In Modbus a Float32 takes two registers and a Float64 four. Devices disagree about the order of the bytes, so the registers are listed for all four orders. If the values come out as nonsense, paste the registers into the register decoder, which tries every order. To write a value, use the value encoder.
Common mistakes
- Expecting more digits than the format has. Float32 keeps about 7 significant digits: 1234.5678 becomes 1234.5677 and 16 777 217 becomes 16 777 216. Float64 keeps 15 to 16.
- Energy counters in Float32. Above 16 777 216 the step between neighbouring values is 2, at one million it is 0.0625. A kWh counter stored as Float32 stops counting small increments as it grows. The “step to the next value” row shows how coarse it already is.
- Comparing floats for equality in a PLC or a script. 0.1 + 0.2 is not exactly 0.3 in binary. Compare with a tolerance instead.
- Reading the wrong byte order. 230.5 read in a wrong order shows up as −2.4e-41, 2.3e23 or 1.2e-38. The bits are fine, only their order is wrong.
- A missing measurement read as a number. Many devices return NaN (7FC0 0000 or FFFF FFFF) when a value is not available. Treat it as “no data”, not as a reading.
Questions from practice
How do I convert hex to float?
Choose Hex and paste the 8 digits, for example 43668000, which is 230.5. From Modbus you can paste the two registers as they are (4366 8000). If the result is nonsense, the device probably uses another byte order; the register decoder tries all four.
Why is 0.1 stored as 0.100000001490116?
0.1 has no exact binary form, just as 1/3 has no exact decimal form. Float32 stores the nearest value it can, 0.100000001490116119384765625. Programs usually print it as 0.1 because that is the shortest number that reads back as the same bits.
What is the difference between Float32 and Float64?
Float32 (single precision, REAL in IEC 61131-3 PLCs) has 32 bits and about 7 significant digits. Float64 (double precision, LREAL) has 64 bits, 15 to 16 digits and a far larger range. In Modbus Float32 takes two registers and Float64 four.
What do NaN and infinity mean on my device?
Both have all exponent bits set to one. Infinity has a zero fraction, NaN (not a number) any other fraction. Devices often send NaN when a measurement is missing, for example when a sensor is not connected; FFFF FFFF is a NaN too. Infinity usually comes from a division by zero or an overflow.
Why does my Float32 counter stop increasing?
Float32 has only 24 bits of precision. Once the value is large, a small increment is less than half the step between neighbouring values and is rounded away. At 16 777 216 the step is already 2. Read the counter as a 32- or 64-bit integer or as Float64 if the device offers it.
Related tools
- 4–20 mA ScalingRaw values to engineering units, 0–10 V and 4–20 mA with fault detection.
- CRC-8 / CRC-16 / CRC-32 CalculatorAny CRC from 3 to 82 bits: 113 named algorithms, your own parameters, and finding which CRC a device uses.
- S5TIME / DT / DTL ConverterSiemens S7 time formats: S5TIME, TIME, DATE, TOD, DATE_AND_TIME and DTL to raw hex and Modbus registers and back.
- P1 Telegram Decoder (DSMR)Decode a smart meter P1 telegram (DSMR, Belgian e-MUCS): OBIS codes, CRC check, power per phase, gas and water.
- Pt100 / Pt1000 CalculatorResistance to temperature and back per IEC 60751, with 2-wire lead error and tolerance classes.
- Thermocouple CalculatormV to °C and back for types K, J, T, E, N, R, S and B, with cold junction compensation.
- Register DecoderFloat32, Int32, UInt16 and bits in every byte order, plus Find my value.
- Address Converter40001 ↔ offset 0, 4x/3x/0x/1x notation, 5- and 6-digit addresses.
- Value EncoderTurn a value like 230.5 into registers for every byte order.
- CRC-16 CalculatorModbus RTU checksum in wire order, plus a full frame check.
- Frame DecoderRead RTU and TCP frames from Wireshark or a serial log.
- Request GeneratorRead and write requests in RTU, TCP and ASCII, plus a check of the reply.
- Frame ConverterThe same Modbus frame as RTU, TCP and ASCII, with CRC, header and LRC recalculated.
- Function & Exception CodesWhat each code means and the usual cause in practice.
- Status Word DecoderName each bit of a 16- or 32-bit status register.
- Modbus RTU Timing CalculatorCharacter time, t1.5 and t3.5, frame length, shortest timeout and how many reads per second fit on the line.
- Register mapsReady-made register maps for meters, inverters and batteries.