IEEE 754 floating-point converter
An IEEE 754 converter for single (32-bit) and double (64-bit) precision. Type a decimal number to see its float bits, the exact value stored and how far it is from what you typed. Click any bit to flip it.
How a float is laid out
A binary32 float is 1 sign bit, 8 exponent bits and 23 significand bits; binary64 uses 1, 11 and 52. For a normal number the value is (−1)sign × 1.significand × 2exponent − bias, where the bias is 127 for binary32 and 1023 for binary64.
An exponent field of all zeros means zero or a subnormal number (no hidden leading 1, used for values very close to zero). All ones means infinity when the significand is zero, and NaN otherwise.
| Number | binary32 (hex) | binary64 (hex) |
|---|---|---|
| 1 | 3F800000 | 3FF0000000000000 |
| 0.1 | 3DCCCCCD | 3FB999999999999A |
| −2 | C0000000 | C000000000000000 |
| 0.5 | 3F000000 | 3FE0000000000000 |
| 100 | 42C80000 | 4059000000000000 |
Why 0.1 + 0.2 isn’t exactly 0.3
0.1 has no exact binary form, just as 1/3 has no exact decimal form. The float stores the nearest value it can, which for binary64 is a little more than 0.1. Adding two of these tiny errors gives a result one step away from the float nearest to 0.3. Type 0.1 into the converter to see the exact value stored and the error.
Sources and method
- W3C WebAssembly Core Specification, section 4.3.1.2: bit layout of binary32 and binary64 floats (sign, exponent with bias 2^(E−1) − 1, significand), formalising IEEE 754-2019. Checked 2026-11-25.
- ECMA-262, ECMAScript Language Specification (Ecma International, living edition at tc39.es), section 6.1.6.1 The Number Type: JavaScript numbers are IEEE 754-2019 binary64 values, with every NaN encoding treated as one NaN. Checked 2026-11-25.
Values come from your browser’s own IEEE 754 hardware (JavaScript DataView), so they match what real programs store. The exact stored value and the error are worked out with exact arithmetic.
Questions
What is the difference between float and double?
In most languages float is binary32 (about 7 significant decimal digits) and double is binary64 (about 15 to 17).
What is a subnormal number?
A value smaller than the smallest normal number, stored with an exponent field of zero and no hidden 1. It trades precision for range near zero.
Why are there two zeros?
The sign bit is separate, so +0 and −0 both exist. They compare as equal, but 1/−0 gives −infinity.