IEEE-754 Float Converter
See how a number is stored as a 32- or 64-bit float: sign, exponent, mantissa, error.
About this tool
Type a decimal number such as 0.1, โ2.5 or 1e-10. Both single-precision (32-bit) and double-precision (64-bit) layouts appear, colour-coded into sign, exponent and mantissa, with the hex value, the exact value stored and the rounding error. To decode raw bits, paste 8 or 16 hex digits.
How floating-point numbers are stored
IEEE-754 is the standard almost every processor uses for non-integer numbers. A number is stored like scientific notation in base 2: a sign bit, an exponent and a fraction (the mantissa). A 32-bit float has 1 sign bit, 8 exponent bits with a bias of 127, and 23 fraction bits. A 64-bit double has 1, 11 and 52 bits, with a bias of 1023. Normal numbers have an implied leading 1 that isn't stored, which buys an extra bit of precision. The catch is that most decimal fractions repeat forever in binary, just as 1/3 does in decimal, so they have to be rounded. 0.1 as a double is really 0.1000000000000000055511151231257827โฆ, stored as hex 3FB999999999999A. As a float, it's 0.100000001490116โฆ, stored as 3DCCCCCD. These tiny errors are why 0.1 + 0.2 prints 0.30000000000000004 in JavaScript and Python, and why money should be handled in whole cents or with decimal types. Special bit patterns represent zero (including โ0), infinity, NaN and subnormal numbers near zero. Single precision keeps about 7 significant decimal digits, and double about 15 to 17. Honest limits: this shows the standard binary formats only, not half precision, bfloat16 or decimal floating point. The binary calculator, the number base converter and the scientific notation converter are related.
Frequently asked questions
Why does 0.1 + 0.2 not equal 0.3?
0.1 and 0.2 can't be stored exactly in binary floating point. Their tiny rounding errors add up to 0.30000000000000004.
What is the hex for 0.1 as a double?
0x3FB999999999999A. As a 32-bit float, it's 0x3DCCCCCD.
How many digits of precision does a float have?
About 7 significant decimal digits for 32-bit floats and 15 to 17 for 64-bit doubles.
Is my input stored?
No. The conversion runs in your browser and nothing is stored or sent.