IEEE 754 Float Converter
See the sign, exponent, and mantissa bits behind any 32-bit float.
Stored value: 1.
32-bit layout: sign · exponent · mantissa
A 32-bit IEEE 754 float packs a number into 1 sign bit, 8 exponent bits (stored with a bias of 127), and 23 mantissa bits. For example, 1.0 becomes 0 01111111 00000000000000000000000: sign 0 (positive), exponent 127 which unbiases to 0, and a mantissa of all zeros representing the implied 1.0.
How a float is laid out
Single-precision floating point stores a real number in 32 bits split into three fields. The sign is one bit: 0 for positive, 1 for negative. The exponent is 8 bits holding a power of two, but offset by a bias of 127 so it can represent both large and tiny magnitudes without a separate sign — the stored value 127 means an actual exponent of 0. The mantissa (also called the fraction or significand) is 23 bits giving the digits after an implicit leading 1. Because that leading 1 is assumed, you effectively get 24 bits of precision — about 7 decimal digits.
Single precision: 1 sign bit · 8 exponent bits (bias 127) · 23 mantissa bits
Worked example: 0.15625
This value encodes exactly, which makes it a clean walkthrough of the three fields.
- 1 Read the sign bit. 0.15625 is positive, so the sign bit is 0, giving (−1)⁰ = +1.
- 2 Read the 8 exponent bits. The exponent field is 01111100 = 124. Subtract the bias: 124 − 127 = −3, so the power of two is 2⁻³.
- 3 Read the 23 mantissa bits. The mantissa is 01000000000000000000000, and with the implicit leading 1 the significand is 1.01₂ = 1.25.
- 4 Combine the fields. value = +1 × 1.25 × 2⁻³ = 1.25 ÷ 8 = 0.15625, matching the input exactly.
Single-precision field layout
The 32 bits, read left to right, split into three fixed-width fields.
| Field | Bits | Meaning |
|---|---|---|
| Sign | 1 | 0 = positive, 1 = negative |
| Exponent | 8 | Power of two, stored with a bias of 127 (range 0–255) |
| Mantissa | 23 | Fraction after the implicit leading 1 (the significand) |
Why 0.1 is not exact, and the special values
Binary floating point can only represent sums of powers of two, so any value whose exact form needs an infinite binary expansion gets rounded to the nearest representable number. 0.1 is such a value: in binary it repeats forever (0.0001100110011…₂), so float32 stores roughly 0.10000000149, not 0.1 exactly. That tiny error is why 0.1 + 0.2 famously does not equal 0.3 on a computer. The tool shows the actual stored value, so you can see the rounding whenever it happens.
Two exponent patterns are reserved. An all-zero exponent marks zero (mantissa all zeros) or a subnormal number that fills the gap just above zero. An all-ones exponent (255) marks Infinity when the mantissa is zero and NaN — Not a Number — when it is not. Double precision (64-bit) uses the same scheme with an 11-bit exponent (bias 1023) and a 52-bit mantissa, giving about 15–16 decimal digits instead of 7, which is why most languages default to it.