PLCBytes
Converters & calculators

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

Example
Input

Decimal: 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
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

OrderHexDecimal

Float64 (double precision, LREAL)

Value (shortest form)
Exact stored value
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

OrderHexDecimal

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.

ValueFloat32 ABCDFloat32 CDABFloat64
0.013C23D70AD70A 3C233F847AE147AE147B
0.53F0000000000 3F003FE0000000000000
1.53FC000000000 3FC03FF8000000000000
2.0400000000000 40004000000000000000
5.040A000000000 40A04014000000000000
−5.0C0A000000000 C0A0C014000000000000
10.0412000000000 41204024000000000000
12.5414800000000 41484029000000000000
20.041A000000000 41A04034000000000000
25.041C800000000 41C84039000000000000
50.0424800000000 42484049000000000000
60.0427000000000 4270404E000000000000
100.042C800000000 42C84059000000000000
230.0436600000000 4366406CC00000000000
230.5436680008000 4366406CD00000000000
400.043C800000000 43C84079000000000000
1000.0447A00000000 447A408F400000000000
1000.5447A20002000 447A408F440000000000

Special values

Bit patterns worth recognising when you read raw registers. The value is under each pattern.

ValueFloat32Float64
Zero00000000000000000000000000
Negative zero80000000-08000000000000000-0
One3F80000013FF00000000000001
Minus oneBF800000-1BFF0000000000000-1
0.1 (nearest value)3DCCCCCD0.13FB999999999999A0.1
Largest whole number with no gaps below it (2^24 / 2^53)4B8000001677721643400000000000009007199254740992
Smallest positive (subnormal)000000011e-4500000000000000015e-324
Smallest normal008000001.1754944e-3800100000000000002.2250738585072014e-308
Largest finite7F7FFFFF3.4028235e+387FEFFFFFFFFFFFFF1.7976931348623157e+308
Infinity7F800000Infinity7FF0000000000000Infinity
Minus infinityFF800000-InfinityFFF0000000000000-Infinity
NaN (quiet)7FC00000NaN7FF8000000000000NaN

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

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