IEEE 754 Floating Point Converter
Convert a decimal number to IEEE 754 single (32-bit) or double (64-bit) precision: sign, exponent and fraction bits, hex, the exact stored value and the rounding error — or decode hex bits back to decimal.
How it works
value = (−1)^sign × 1.fraction₂ × 2^(exponent − bias) · single: 1 + 8 + 23 bits, bias 127 · double: 1 + 11 + 52 bits, bias 1023 · exponent all 0s → subnormal (0.fraction × 2^(1 − bias)) or zero · all 1s → infinity or NaN · rounding: round-to-nearest, ties to even
IEEE 754 stores a real number as a sign bit, a biased exponent and a fraction (the significand without its leading 1). Most decimal fractions — 0.1, 0.2, 0.3 — have no finite binary expansion, so they are rounded to the nearest representable value. The converter shows the bit fields, the exact decimal value actually stored (computed with big-integer arithmetic, not approximated) and the rounding error, which explains why 0.1 + 0.2 ≠ 0.3 in most programming languages.
Worked example
0.1 in single precision: sign 0, exponent 01111011 = 123 → 123 − 127 = −4, fraction 10011001100110011001101. The hex pattern is 0x3DCCCCCD and the value really stored is 0.100000001490116119384765625 — a conversion error of +1.490e-9. In double precision the same number is 0x3FB999999999999A.
Sources: IEEE 754-2019 Standard for Floating-Point Arithmetic · D. Goldberg, What Every Computer Scientist Should Know About Floating-Point Arithmetic (1991)
Frequently asked questions
Why can’t 0.1 be stored exactly?
In binary, 1/10 is the repeating fraction 0.000110011001100…, just as 1/3 repeats in decimal. The format keeps 24 (single) or 53 (double) significant bits and rounds the rest, so the stored value is slightly off — 0.100000001490116… in single precision.
What is the exponent bias?
The exponent field is stored as an unsigned number with an offset (127 for single, 1023 for double) so that it can represent negative powers of two. Subtract the bias from the stored field to get the real exponent.
What are subnormal numbers?
When the exponent field is all zeros the implicit leading 1 becomes 0, allowing values smaller than 2⁻¹²⁶ (single) or 2⁻¹⁰²² (double) at reduced precision. They fill the gap between the smallest normal number and zero (gradual underflow).
How many decimal digits are accurate?
About 7 significant decimal digits for single precision (24 bits × log₁₀2 ≈ 7.2) and about 15–16 for double (53 bits ≈ 15.95). Printing 9 (single) or 17 (double) digits is enough to round-trip any stored value exactly.
How are infinity and NaN encoded?
An exponent field of all ones with a zero fraction is ±infinity (e.g. 0x7F800000); all ones with a non-zero fraction is NaN (“not a number”, e.g. 0x7FC00000). They result from overflow, division by zero or invalid operations like 0/0.
Related calculators
This calculator is for educational purposes. Double-check important results before acting on them.