IEEE 754 Floating-Point Bit Viewer & Converter
Enter a decimal number to see how IEEE 754 float32 (single) and float64 (double) store it, bit by bit: sign, exponent and mantissa. You can also paste hex or a bit string to decode it back into a number, and NaN, Infinity, -0 and subnormal numbers are all supported. Try an expression like 0.1+0.2 to see exactly where the rounding error comes from. Everything runs in your browser, so nothing you type is sent to a server. For integer base conversion, use the Base Converter.
🔒 Runs in your browser · Your data is never sent to a server
How to use
- Pick float32 (single) or float64 (double) under "Bit width".
- Type a decimal number, 0x hex, a bit string or an expression like 0.1+0.2 into "Value or bits".
- The sign, exponent and mantissa are color-coded, with the exact decimal value and hex below.
- Use "Copy result" to copy everything at once.
Notes
- Without a 0b prefix, a bit string must be exactly as long as the width (32 digits for float32, 64 for float64). With 0b you can omit leading zeros. Spaces and underscores are ignored.
- Add the 0x prefix for hex. Shorter values are padded with zeros on the left.
- Expressions support only two operands with + - * / . In float32 mode each operand and the result are rounded to float32.
- In float32, out-of-range values become Infinity and tiny values become subnormal or zero.
- "Exact decimal value" is the precise value the bits represent, expanded from binary. This is why 0.1 is never exactly 0.1.
- Typing NaN gives the usual quiet NaN (0x7FF8000000000000 in float64). Enter a bit pattern to inspect other NaN payloads.
Glossary
IEEE 754
The standard for floating-point numbers. A value is stored as sign × 1.mantissa × 2^exponent. float32 uses 1 sign bit, 8 exponent bits and 23 mantissa bits; float64 uses 1, 11 and 52.
Biased exponent
The stored exponent is the actual exponent plus a bias (127 for float32, 1023 for float64), so negative exponents fit in an unsigned field.
Subnormal number
A number whose exponent bits are all 0. The implicit leading bit is 0 instead of 1, which lets the format represent very small values close to zero.
NaN / Infinity
Special values with all exponent bits set to 1. A zero mantissa means Infinity; anything else is NaN (Not a Number). If the top mantissa bit is 1 it is a quiet NaN, otherwise a signaling NaN.
Why 0.1 + 0.2 is not 0.3
Both 0.1 and 0.2 are repeating fractions in binary, so they are stored as rounded approximations. Their sum is rounded again, giving 0.30000000000000004.
FAQ
Why is 0.1 + 0.2 not exactly 0.3?
Neither 0.1 nor 0.2 can be written exactly in binary, so float64 stores slightly-off approximations. Adding them and rounding again gives 0.30000000000000004. Enter 0.1+0.2 here to see the resulting bits and exact decimal value.
What is the difference between float32 and float64?
float32 has 32 bits (1 sign, 8 exponent, 23 mantissa) and about 7 significant digits. float64 has 64 bits (1, 11, 52) and about 15 to 17 digits. A JavaScript Number is a float64.
How do I convert a bit string or hex back to a number?
Prefix hex with 0x, as in 0x3FB999999999999A. A binary string must have the full width (32 digits for float32, 64 for float64) unless it starts with 0b, which lets you drop leading zeros. It is read at the selected bit width.
How are NaN, -0 and subnormal numbers shown?
An all-ones exponent means Infinity or NaN, and an all-zero exponent with a non-zero mantissa is subnormal. -0 is zero with only the sign bit set; it compares equal to 0 but has different bits. "Kind of value" tells you which one you have.
Share this page
