Hex to Float Step-by-Step Visualization
Follow 41480000 → 12.5 through the sign, exponent, and fraction.
Examples
Input
Spaces and an optional 0x prefix are accepted. Read the most significant byte first.
Output
Hexadecimal writes binary data compactly: each hex digit represents four bits. Eight hex digits can store one IEEE 754 single-precision float.
Why convert hex to float?
Values from memory, files, or device registers are often written in hex. Reading their sign, exponent, and fraction reveals the floating-point number stored in those bits.
How to convert hex to float
- Expand the hex digits. Write four bits for every digit, keeping leading zeros.
- Split the 32 bits. Take 1 sign bit, 8 exponent bits, and 23 fraction bits.
- Decode the exponent. For a normal value, subtract 127 from the stored exponent.
- Build the significand. Read the fractional place values ½, ¼, ⅛, and so on, then add the implicit leading 1.
- Combine the fields. Multiply the sign factor, significand, and power of two.
In the Viz, 41480000 gives sign +, exponent 130 − 127 = 3, and significand 1.5625. The result is 1.5625 × 2³ = 12.5.
Zero and subnormal values have an exponent field of 0. Subnormals use exponent −126 without the implicit leading 1. An exponent field of 255 represents infinity or NaN. The calculator handles these patterns too.
Hex to Float Conversion Table
| Hex | Float | Meaning |
|---|---|---|
41480000 | 12.5 | Worked example in the Viz |
3F800000 | 1 | Positive one |
3F000000 | 0.5 | One half |
C0200000 | −2.5 | Negative number |
00000000 | 0 | Positive zero |
80000000 | −0 | Negative zero |
7F800000 | +Infinity | Positive infinity |
7FC00000 | NaN | Not a number |
Some decimal fractions are rounded in binary32. For example, 3DCCCCCD stores 0.10000000149011612, close to 0.1.
Key terms
| Term | Meaning |
|---|---|
| IEEE 754 | The floating-point standard used by this 32-bit format. |
| Sign bit | 0 means positive; 1 means negative. |
| Exponent | The 8-bit field that controls the power of two. |
| Bias | The offset 127 subtracted from the stored exponent for normal values. |
| Fraction | The 23 stored bits after the binary point. |
| Significand | For normal values, 1 plus the fraction. |