How the IEEE 754 converter works
Type a decimal — 0.1, −12.375 or 6.02e23 — and pick 32-bit or 64-bit. The result card shows the hex pattern, the value actually stored and how far it is from what you typed. The bit grid colours the sign, exponent and mantissa, and the field table works out the exponent minus the bias. Below that, your number is written in binary before rounding, with any repeating block in brackets, so you can see exactly why it did or did not fit.
Bits → decimal decodes a pattern copied from a debugger or a hex dump. Whole numbers stored as integers rather than floats belong in the two's complement calculator.
The IEEE 754 formula
Example: 0x40490FDB as a float: sign 0, exponent 128 − 127 = 1, mantissa 1.5707963…, so the value is 1.5707963… × 2 = 3.14159274…, the nearest float to π. The formats are defined by IEEE 754-2019 (source: IEEE).
Worked examples
Example 1 — −12.375 as a 32-bit float
- Decimal:
- −12.375
- Sign: 1 (negative)
- 12.375 in binary: 1100.011
- Normalise: 1.100011 × 2³
- Exponent field: 3 + 127 = 130 = 10000010
- Mantissa (23 bits): 10001100000000000000000
Pattern: C1460000
12.375 = 12 + 3/8 has a power-of-2 denominator, so it is stored exactly: the rounding error is 0.
Example 2 — decoding 0x3F800000
- Pattern:
- 0011 1111 1000 0000 …
- Sign bit: 0
- Exponent bits 01111111: 127 − 127 = 0
- Mantissa all zeros: 1.0
Value: 1.0 × 2⁰ = 1
Landmark values in single and double precision
| Value | 32-bit float (hex) | 64-bit double (hex) |
|---|---|---|
| 1 | 3F800000 | 3FF0000000000000 |
| 0.5 | 3F000000 | 3FE0000000000000 |
| 0.1 (rounded) | 3DCCCCCD | 3FB999999999999A |
| −2 | C0000000 | C000000000000000 |
| −0 | 80000000 | 8000000000000000 |
| Smallest subnormal | 00000001 | 0000000000000001 |
| Largest finite | 7F7FFFFF | 7FEFFFFFFFFFFFFF |
| Infinity | 7F800000 | 7FF0000000000000 |
| NaN (quiet) | 7FC00000 | 7FF8000000000000 |
Key facts
- An IEEE 754 single-precision float has 1 sign bit, 8 exponent bits with a bias of 127, and 23 mantissa bits.
- An IEEE 754 double has 1 sign bit, 11 exponent bits with a bias of 1023, and 52 mantissa bits, and it is the format of every JavaScript number.
- The decimal 0.1 stored as a 32-bit float is exactly 0.100000001490116119384765625, pattern 0x3DCCCCCD.
- An exponent field of all ones means Infinity when the mantissa is zero and NaN when it is not.
Float or double: which format are you looking at?
A C or Java float, a GPU shader value and most sensor and audio samples are 32-bit single precision, with 24 significant bits — about 7 decimal digits. A double, a Python float and every JavaScript number are 64-bit, with 53 significant bits, enough for 15 to 17 digits; MDN documents the JavaScript layout as 1 sign, 11 exponent and 52 mantissa bits (source: MDN). Use this converter when a value prints with a stray last digit, when you need to read bytes from a binary file or network packet, or when you are learning how floating point works.
Common IEEE 754 mistakes
- Forgetting the hidden 1. A normal number's mantissa bits are the part after the point; the leading 1 is implied and not stored.
- Reading the exponent without the bias. 01111011 is 123 stored but −4 meant.
- Expecting decimal fractions to be exact. Only fractions whose denominator is a power of 2, such as 0.5 or 0.375, fit exactly.
- Comparing with ==. Two routes to the “same” number can round differently; compare within a tolerance, and remember NaN never equals itself.
Frequently Asked Questions
Why is 0.1 not stored exactly?
In binary, 0.1 is 0.000110011001100… with the 0011 block repeating forever, just as 1/3 never ends in decimal. A float has only 24 significant bits and a double 53, so the pattern is cut off and rounded. As a 32-bit float, 0.1 is really 0.100000001490116119384765625.
Why does 0.1 + 0.2 not equal 0.3 in JavaScript?
JavaScript numbers are IEEE 754 doubles. 0.1 and 0.2 are each rounded when stored, and their sum rounds to the double just above 0.3, which prints as 0.30000000000000004. Compare floating-point results with a small tolerance rather than with ===.
What is the exponent bias?
The exponent field is stored as an unsigned number with a fixed offset added, so it never needs its own sign bit. The bias is 127 for 32-bit floats and 1023 for 64-bit doubles: a stored exponent of 123 in a float means 2 to the power 123 − 127 = −4.
What is a subnormal number?
When the exponent field is all zeros, the hidden leading 1 becomes a 0 and the exponent is fixed at its minimum. That lets values smaller than the smallest normal number fade gradually to zero. The smallest positive subnormal is 2⁻¹⁴⁹ in a float and 2⁻¹⁰⁷⁴ in a double.
How are Infinity and NaN stored?
Both have an exponent field of all ones. With a mantissa of all zeros the value is Infinity, positive or negative by the sign bit; with any non-zero mantissa it is NaN. That is why 0x7F800000 is +Infinity as a float and 0x7FC00000 is a NaN.
Why are there two zeros, +0 and −0?
The sign bit is separate from the rest, so a zero can carry either sign: 0x00000000 and 0x80000000 as floats. They compare equal, but they behave differently in a few places, such as 1 / −0 giving −Infinity. The converter keeps the sign when you type -0.
Related calculators
Notes & Assumptions
- Decimals are rounded to the nearest float or double, ties to even, as IEEE 754's default rounding does. The exact stored value and the rounding error are computed with whole-number arithmetic.
- Only the binary32 and binary64 formats are covered; half precision, extended precision and the decimal formats of IEEE 754 are not.
- Every NaN entered as text is stored as the quiet NaN your browser produces; a pasted pattern keeps its own payload bits.
This tool is for education and debugging. Check behaviour that matters in production — rounding modes, flush-to-zero, NaN handling — against your compiler and processor documentation.