How to use the Hex to Float Converter tool
- Enter the 32-bit pattern in Hexadecimal bits, for example C1540000 or 0x3F800000, with the most significant byte first.
- Select Convert, or select Example to decode C1540000.
- Read the decoded number in the result panel. Special patterns appear as Infinity, -Infinity, NaN or -0.
- Select Copy to copy the value.
Hex to float: decoding a 32-bit pattern
Eight hex digits give 32 bits: 1 sign bit, 8 exponent bits and 23 fraction bits. For exponent fields 1 to 254 the value is 1.fraction x 2^(exponent - 127). An exponent field of 0 means a subnormal or zero, and 255 means Infinity or NaN. Sign and exponent occupy 9 bits, so they do not line up with hex digits, and the pattern has to be written out in binary to be read by hand.
Worked example: C1540000 is -13.25
In binary, C1540000 is 1100 0001 0101 0100 followed by sixteen zeros. The first bit is the sign: negative. The next eight bits, 10000010, are 130, so the exponent is 130 - 127 = 3. The fraction begins 10101, giving a significand of 1.10101 in binary, or 1.65625. 1.65625 x 8 is 13.25, and the sign makes it -13.25.
C1540000 -> -13.25
3F800000 -> 1
447A0000 -> 1000
3DCCCCCD -> 0.10000000149011612
40490FDB -> 3.1415927410125732
7F7FFFFF -> 3.4028234663852886e+38
00000001 -> 1.401298464324817e-45
FF800000 -> -InfinityWhy the output has so many digits
The tool converts the float to a double without changing its value and prints it with double-precision digits. So 3DCCCCCD appears as 0.10000000149011612, the float's true value, where a C program printing a float would show 0.1.
If you want the short form, round the output to 9 significant digits or fewer. Nine digits are always enough to identify a single-precision value uniquely.
Input formats, padding and byte order
The field is forgiving about formatting but strict about length, so check these rules when a result looks wrong.
- Up to 8 hex digits in either case, with an optional 0x prefix. Spaces are removed, so C1 54 00 00 works.
- Binary input with 0b and up to 32 digits.
- Fewer than 8 digits are right-aligned and zero-filled on the left. C154 is read as 0000C154 and gives 6.935306359636385e-41.
- Digits are taken as one big-endian number. A little-endian dump such as 00 00 54 C1 must be reversed first.
- Input starting with 0b and containing only 0s and 1s after it is parsed as binary. Prefix real hex with 0x.
- Anything else returns Enter up to 8 hexadecimal digits or a binary number prefixed with 0b.
Where 32-bit hex floats come from
Industrial devices are a common source. A Modbus float spans two 16-bit registers, and vendors disagree on which register comes first. CAN signals, sensor protocols, WAV and STL files, GPU buffers and debugger memory views all expose floats as raw words as well.
Frequently asked questions
How do I convert hex to float in Python?
struct.unpack('>f', bytes.fromhex('C1540000'))[0] returns -13.25. Python widens the result to a double, so 3DCCCCCD prints as 0.10000000149011612 there too.
How do I decode a float from two Modbus registers?
Write the two 16-bit registers as four hex digits each and join them, high word first, to get eight digits. If the decoded number is absurd, the device probably sends the low word first, so swap the two halves and try again.
Why did I get a tiny number such as 6.9e-41?
The pattern was shorter than eight digits, so it was padded on the left and the exponent field became zero. Type the trailing zeros. C154 alone is a subnormal, while C1540000 is -13.25.
What does 7FC00000 decode to?
NaN. Any pattern whose exponent field is all ones and whose fraction is not zero is a NaN, including 7FA00000 and FFFFFFFF. The tool prints them all as NaN and does not show the payload or the sign.
What is the difference between this tool and the IEEE 754 Float Analyzer?
This page returns only the decoded number, which is convenient for copying. The analyzer accepts the same hex input and adds the 32-bit string, the sign, exponent and fraction fields, and a class such as normal or subnormal.
Does the hex I paste leave my computer?
No. Decoding is a local DataView operation in your browser: the digits are written into a 4-byte buffer and read back as a float. No network request is involved.