IEEE 754 Float Converter
Type a decimal such as 0.1, or paste a hex or binary pattern, and see how it is stored as a 32 bit float or a 64 bit double. The tool splits the bits into sign, exponent and fraction, tells you whether the number is normal, subnormal, zero, infinity or NaN, shows the exact decimal value that is really stored, and gives the shortest decimal that reads back as the same number. Everything runs in your browser.
| Limit of 32 bit | Value | Hex |
|---|---|---|
| Largest finite | 3.4028235e+38 | 7F7FFFFF |
| Smallest normal | 1.1754944e-38 | 00800000 |
| Smallest subnormal | 1e-45 | 00000001 |
A binary floating point number is stored as three fields: a sign bit, an exponent and a fraction. A 32 bit float uses 1, 8 and 23 bits, and a 64 bit double uses 1, 11 and 52. For a normal number the value is (1 + fraction) x 2^(exponent minus bias), with a bias of 127 or 1023. Most decimals, such as 0.1, have no exact binary form, so the nearest stored number is slightly off, and that is why 0.1 + 0.2 shows as 0.30000000000000004 in a double. The exact value shown is the full decimal expansion of what is really stored. An all-ones exponent means infinity or NaN, and an all-zero exponent means zero or a subnormal number. Everything is worked out in your browser and nothing is uploaded.
Related Tools
[5 suggestions]Bitwise Calculator
Apply AND, OR, XOR, NOT, shifts and rotations to 8, 16, 32 or 64-bit numbers and see the result in binary, hexadecimal and signed and unsigned decimal.
Developer & WebNumber Base Converter
Convert whole numbers between binary, octal, decimal, hex and any base from 2 to 36, with two's complement.
Developer & WebScientific Notation Converter
Convert a number to scientific, engineering, E and standard notation, round to significant figures and see the SI prefix, with every digit kept exact.
Student ToolsText to Hex Converter
Convert text to hexadecimal bytes and hex back to text, in UTF-8, UTF-16 or Latin-1, with your choice of separator and prefix.
Format ConversionUnicode Character Inspector
See every code point in your text with its U+ number, category, script, UTF-8 bytes and UTF-16 units, and spot hidden characters.
Developer & WebAbout the IEEE 754 Float Converter
Most programming languages store non-integer numbers as IEEE 754 binary floating point. A 32 bit float has 1 sign bit, 8 exponent bits and 23 fraction bits. A 64 bit double has 1, 11 and 52. For a normal number the value is (1 + fraction) x 2 to the power of (exponent minus bias), with a bias of 127 for a float and 1023 for a double. An exponent of all ones means infinity (fraction zero) or NaN, and an exponent of all zeros means zero or a subnormal number, which trades precision for a smaller range near zero. Because the fraction is binary, most decimals have no exact form. The number 0.1 is stored as the nearest float, 0.100000001490116119384765625 (hex 3DCCCCCD), or as the nearest double, 0.1000000000000000055511151231257827021181583404541015625 (hex 3FB999999999999A). That small error is why 0.1 + 0.2 gives 0.30000000000000004. Above 16,777,216 a 32 bit float can no longer store every whole number, so 16,777,217 is stored as 16,777,216, and a double does the same above 9,007,199,254,740,992. The tool shows the gap to the next number, which is the unit in the last place, and the limits of each format: the largest finite float is about 3.4028235e38 and the largest double about 1.7976931348623157e308. Nothing is uploaded.
How is a floating point number stored?▾
As three fields: a sign bit, an exponent and a fraction. A 32 bit float uses 1, 8 and 23 bits, and a 64 bit double uses 1, 11 and 52. The value is (1 + fraction) x 2 to the power of (exponent minus bias) for a normal number.
Why is 0.1 + 0.2 not exactly 0.3?▾
Neither 0.1 nor 0.2 has an exact binary form, so each is stored as the nearest double. Their sum rounds to 0.30000000000000004, which is a different double from the one stored for 0.3.
What is the difference between float and double?▾
A float has 24 significant bits, about 7 decimal digits, and a double has 53, about 15 to 17 digits. A double also has a far larger range. The float is half the size, which matters for graphics and large arrays.
What are subnormal numbers?▾
They are numbers smaller than the smallest normal value, stored with an exponent of all zeros and no hidden leading one. They fill the gap between zero and the smallest normal number, with less precision as they shrink.
Is my data uploaded?▾
No. The conversion runs in your browser and nothing you enter is sent anywhere.