See exactly how a decimal number is stored as an IEEE 754 float or double – sign, exponent and mantissa bits – and why 0.1 + 0.2 does not equal 0.3.
Show calculation steps
Processed privately in your browser — nothing you paste is uploaded, logged or stored.
The bits behind every float
IEEE 754 packs a number into sign, biased exponent and mantissa fields. This converter shows the exact packing for your input — every bit, the hex bytes, the field values decoded, and the precise decimal value actually stored, which for most decimal inputs is NOT the number you typed.
That last point is the famous one: 0.1 has no finite binary expansion, so the nearest double is 0.1000000000000000055511151231257827021181583404541015625. Seeing the true stored value dissolves the 0.1+0.2 mystery permanently.
Worked example
Value: −0.15625, single precision Sign 1 Exponent 01111100 (124; actual 124−127 = −3) Mantissa 01000000000000000000000 −0.15625 = −1.25 × 2⁻³ All bits: 10111110 00100000 00000000 00000000 Hex: BE 20 00 00
| Field | Single (32-bit) | Double (64-bit) |
|---|---|---|
| Sign | 1 bit | 1 bit |
| Exponent | 8 bits (bias 127) | 11 bits (bias 1023) |
| Mantissa | 23 bits | 52 bits |
| Decimal digits (approx.) | ~7 | ~16 |
Specials and subnormals
All-ones exponent encodes ±Infinity (mantissa zero) and NaN (mantissa non-zero). All-zeros exponent encodes zero and the subnormal range, where precision fades gracefully toward zero. The classifier line names the regime for any input — try 1e-310 in double to visit subnormal territory.
Single versus double
The same value rounds differently at 23 versus 52 mantissa bits; comparing both encodings side by side is the concrete way to understand “float precision”. Roughly 7 decimal digits survive a float, 16 a double — the table above anchors the intuition.
Privacy
Encoding uses your browser’s own IEEE hardware via typed arrays, entirely on-device.
How to use the IEEE 754 Floating Point Converter
- Enter a decimal number – plain, scientific (1.5e-3), or the specials Infinity and NaN.
- Choose single (32-bit float) or double (64-bit) precision.
- Click "Encode as float".
- You get the sign, exponent and mantissa fields, all bits, the hex bytes, and the EXACT value actually stored.
Frequently asked questions
How is a number laid out in IEEE 754?
Three fields: 1 sign bit, then a biased exponent (8 bits single / 11 double), then the mantissa fraction (23 / 52 bits) with an implicit leading 1 for normal numbers. −0.15625 encodes as 1 | 01111100 | 01000000… = 0xBE200000 in single.
What is the exponent bias for?
It lets exponents be stored as unsigned: stored = actual + 127 (single) or +1023 (double). An exponent field of 01111100 means 124 − 127 = 2⁻³ – the steps decode this for your number.
Why does 0.1 come out "wrong"?
Because 0.1 has no finite binary expansion, the nearest double is 0.1000000000000000055511151231257827021181583404541015625 – bytes 3F B9 99 99 99 99 99 9A. The tool prints the exact stored value, which is the honest explanation of 0.1+0.2≠0.3.
What are subnormal numbers?
Values with the all-zero exponent field: the implicit leading 1 switches off and precision degrades gradually toward zero instead of cliff-dropping. The classifier line names them when your input lands there (try 1e-310 in double).
How do Infinity and NaN encode?
All-ones exponent: mantissa zero means ±Infinity; any non-zero mantissa is NaN. That reserved pattern is why the maximum finite exponent is one step short of the field's ceiling.
Why do float and double disagree about the same input?
Different mantissa widths round at different points: 0.1 as a float stores a different (coarser) neighbour than as a double. Comparing the two encodings side by side is the fastest way to see precision loss concretely.
Is my number processed locally?
Yes – the encoding uses your browser's own IEEE hardware via typed arrays, entirely on-device.