IEEE 754 float32 and float64 converter
Type a decimal number to see the float32 or float64 bits that store it and the exact value they really hold, or type a bit pattern such as 0x7f800001 to decode it. The page shows the sign, exponent and fraction, what was rounded away, the neighbouring values, and special cases. Nothing leaves your browser.
How to use
- Choose the Format: float32 (binary32, 32 bits) or float64 (binary64, 64 bits, the type of every JavaScript Number).
- Type a decimal number such as
0.1,-2.5e-3or16777217. The tool reads the text exactly as a fraction, with no intermediate floating-point step, and rounds it once, to the nearest value the format can hold, with ties going to the value with an even last bit. Or type a bit pattern starting with0xor0b, or the wordsNaN,Infinityor-Infinity. - Read the bit layout: the sign bit, the exponent field (stored with a bias, 127 for float32 and 1023 for float64) and the fraction field. Click a bit to flip it and see the value change.
- Read Exact value. This is the number the bits really mean, written out in full. For almost every decimal fraction it differs slightly from what you typed. The tool reports which rounding happened (exact, nearest, a tie rounded to even, overflow, or underflow to zero) and how far off the stored value is.
- Check the neighbours: the next lower and next higher values that the format can store, with their bit patterns. Their distance is the unit in the last place (ulp) at that magnitude.
- The last section compares the tool's bits with the browser's own
DataViewconversion, so you can see the two agree.
The same field layout applies to every pattern; these are the special ones the tool decodes (each decoded by the same code and checked in the tests):
| Name (float32) | Hex | Bits (sign, exponent, fraction) | Class | Value |
|---|---|---|---|---|
| +0 | 00000000 | 0 00000000 00000000000000000000000 | zero | 0 |
| -0 | 80000000 | 1 00000000 00000000000000000000000 | zero | -0 |
| smallest positive subnormal | 00000001 | 0 00000000 00000000000000000000001 | subnormal | 1e-45 |
| largest subnormal | 007fffff | 0 00000000 11111111111111111111111 | subnormal | 1.1754942e-38 |
| smallest positive normal | 00800000 | 0 00000001 00000000000000000000000 | normal | 1.1754944e-38 |
| 1.0 | 3f800000 | 0 01111111 00000000000000000000000 | normal | 1 |
| largest finite | 7f7fffff | 0 11111110 11111111111111111111111 | normal | 340282346638528859811704183484516925440 |
| +Infinity | 7f800000 | 0 11111111 00000000000000000000000 | infinity | Infinity |
| quiet NaN | 7fc00000 | 0 11111111 10000000000000000000000 | nan-quiet | NaN |
| signaling NaN (payload 1) | 7f800001 | 0 11111111 00000000000000000000001 | nan-signaling | NaN |
Where the exact decimal expansion is longer than 40 digits (the subnormals and the largest finite value) the shortest decimal that reads back to the same value is shown instead. The tool shows the full exact value.
Worked examples
Each result below is recomputed by an automated test from the tool's engine. The bit fields of the first two were also split by hand from the hex, and the hex values were compared with DataView in the tests.
0.1 in float32
The hex 3dcccccd is the bits 0 01111011 10011001100110011001101. The exponent field 01111011 is 123, and 123 - 127 = -4, so the value is 1.100110011001100110011012 x 2-4. The exact binary expansion of 0.1 is 1.1001 1001 1001 ... x 2-4 forever; the 23 stored fraction bits are 10011001100110011001100 and the bits that follow begin 1100..., which is more than half a unit, so the last stored bit is rounded up from ...100 to ...101. The stored value is therefore a little more than 0.1.
float32
Input: 0.1
Output: 3dcccccd: nearest, exact value 0.100000001490116119384765625
0.1 in float64
The hex 3fb999999999999a splits as sign 0, exponent field 01111111011 = 1019, and 1019 - 1023 = -4 again; the fraction is the block 1001 twelve times and then 1010. The stored value is slightly above 0.1, by a bit under 5.6 x 10-18.
float64
Input: 0.1
Output: 3fb999999999999a: nearest, exact value 0.1000000000000000055511151231257827021181583404541015625
Numbers that are exact
1.5 is 1.12 x 20: exponent field 127, fraction 1000...0. 100 = 1.5625 x 26, so the exponent field is 133 and the pattern is 42c80000.
float32
Input: 1.5
Output: 3fc00000: exact, exact value 1.5
float32
Input: 100
Output: 42c80000: exact, exact value 100
Negative zero
Only the sign bit is set. It compares equal to +0 but is a different bit pattern, and is why IEEE 754 has signed zero (Wikipedia: IEEE 754).
float64
Input: -0
Output: 8000000000000000: exact, exact value -0
A tie rounds to even
float32 has a 24-bit significand, so from 224 up only even integers are available. 16777217 is exactly between 16777216 and 16777218. The default rule, round to nearest and ties to even, selects 16777216. In float64 the same happens at 253 + 1.
float32
Input: 16777217
Output: 4b800000: tie-even, exact value 16777216
float64
Input: 9007199254740993
Output: 4340000000000000: tie-even, exact value 9007199254740992
Decoding a pattern
Exponent all ones with a non-zero fraction is a NaN. The top fraction bit is 0 here; the standard recommends 0 there for a signaling NaN and 1 for a quiet NaN (Wikipedia: IEEE 754, note on NaN encoding), so this pattern is read as a signaling NaN with payload 1.
float32
Input: 0x7f800001
Output: 7f800001: nan-signaling
The smallest subnormal
The pattern 00000001 has exponent field 0 and fraction 1, so the value is 2-126 x 2-23 = 2-149, about 1.4 x 10-45. The decimal below is the exact value of 2-149.
float32
Input: 1e-45
Output: 00000001: nearest, exact value 0.00000000000000000000000000000000000000000000140129846432481707092372958328991613128026194187651577175706828388979108268586060148663818836212158203125
What goes wrong
Cases where floating point surprises people. All results are the tool's exact output and are covered by tests.
123456789 loses its last digits in float32
123456789 lies between 226 and 227, where float32 values are 8 apart, so the nearest multiple of 8 is 123456792. A float32 can only promise 6 to 9 significant digits (Wikipedia), which is why IDs and counters should not be stored in it.
float32
Input: 123456789
Output: 4ceb79a3: nearest, exact value 123456792
0.3 as float64 is slightly below 0.3
The stored value is a little less than 0.3, which is why 0.1 + 0.2 === 0.3 is false in JavaScript.
float64
Input: 0.3
Output: 3fd3333333333333: nearest, exact value 0.299999999999999988897769753748434595763683319091796875
The sum 0.1 + 0.2 lands on the next double up, whose bits and exact value are:
float64
Input: 0.30000000000000004
Output: 3fd3333333333334: nearest, exact value 0.3000000000000000444089209850062616169452667236328125
1e39 is too large for float32
The largest finite float32 is about 3.4028235 x 1038. Anything that rounds above it becomes infinity: 7f800000. (The exact boundary is half an ulp above the largest finite value, 340282356779733661637539395458142568448; one less rounds back down to 7f7fffff.)
float32
Input: 1e39
Output: 7f800000: overflow (Infinity)
1e-46 rounds to zero in float32
The smallest positive float32 is 2-149 (about 1.4 x 10-45). Half of that, about 7 x 10-46, is the tie point; 1e-46 is below it, so it rounds to +0.
float32
Input: 1e-46
Output: 00000000: underflow-zero, exact value 0
An expression is not a number
The field takes one number, not an expression. Evaluate it first (or use the base converter for each part) and paste the result.
float64
Input: 0.1+0.2
Error: Unexpected character "+" at position 4.
A 64-bit pattern typed while float32 is selected
float32
Input: 0x7ff0000000000001
Error: A 32-bit pattern has at most 8 hex digits; you typed 16.
Limits & gotchas
- Two formats. Only binary32 and binary64. Half precision (binary16), quad precision (binary128), the decimal formats, bfloat16 and the 80-bit x87 format are not offered.
- Rounding mode. Only the default, round to nearest with ties to even. IEEE 754 defines four other modes (toward zero, up, down and ties away from zero), which the tool does not show.
- NaN. A NaN has many bit patterns. Typing
NaNproduces the quiet NaN with payload 0; ECMAScript specifies a single NaN value in the Number type, so a JavaScript program cannot tell you which NaN bits it holds (the bits are only observable through typed arrays and may be canonicalised). Pattern input shows any NaN exactly. - Input size. At most 2000 characters, and a decimal exponent of at most 5000 in size. Arithmetic is exact (arbitrary-size integers), so long inputs round correctly, not approximately.
- No arithmetic. The tool converts and explains one number at a time. It does not add or multiply floats.
- The IEEE 754 standard itself was not read. It is a paid document. Facts about the formats come from the secondary sources below and were checked against the browser's typed arrays.
- Browser. Tested in a current Chrome only.
FAQ
Why is 0.1 + 0.2 equal to 0.30000000000000004?
Neither 0.1 nor 0.2 is stored exactly. In binary64 0.1 is 0.1000000000000000055511151231257827... and 0.2 is 0.2000000000000000111022302462515654..., both slightly too big. Their exact sum is not itself a binary64 number, so it is rounded to the nearest one, which prints as 0.30000000000000004. The double nearest to 0.3 is a different one, 0.299999999999999988897769753748434595763683319091796875, so 0.1 + 0.2 === 0.3 is false. Paste each number into the tool to see the exact stored values.
What is the difference between float32 and float64?
Width and precision. float32 (binary32) has 1 sign bit, 8 exponent bits with bias 127 and a 24-bit significand (23 stored), good for 6 to 9 significant decimal digits. float64 (binary64) has 1 sign bit, 11 exponent bits with bias 1023 and a 53-bit significand (52 stored), good for 15 to 17 digits (Wikipedia: single- and double-precision formats). JavaScript Numbers are always float64; Math.fround rounds a Number to the nearest float32.
Why does 16777217 turn into 16777216 in float32?
A float32 has a 24-bit significand, so above 2^24 = 16777216 only every second integer exists. 16777217 is exactly halfway between 16777216 and 16777218. IEEE 754's default rounding, round to nearest with ties to even, picks the neighbour whose last significand bit is 0, which is 16777216. The same thing happens one binade up: 16777219 is halfway between 16777218 and 16777220 and rounds to 16777220. In float64 the same effect starts at 2^53 + 1 = 9007199254740993, which rounds to 9007199254740992.
What do the exponent bits mean, and what are subnormals?
For a normal number the stored exponent minus the bias gives the power of two, and the significand has an implied leading 1. When the exponent field is all zeros the leading digit is 0 instead and the exponent is fixed at the smallest normal exponent: these are the subnormal (denormalized) numbers, which fill the gap between 0 and the smallest normal number, a feature Goldberg calls gradual underflow. When the field is all ones, the value is infinity (fraction 0) or a NaN (fraction not 0). The landmarks table on this page lists the bit patterns for each case.
Is the tool using the IEEE 754 standard itself?
The standard (IEEE 754-2019) is sold by the IEEE and was not read for this site. The formats and rules used here come from the secondary sources listed under Sources (Wikipedia's articles on IEEE 754 and on the single and double formats, Goldberg's paper, and the ECMAScript specification, which defines the Number type as IEEE 754 binary64) and were verified in tests: the tool's conversions are compared with the browser's own DataView, Float32Array and Float64Array on thousands of random values. If you need an authoritative statement, buy the standard.
Sources
- IEEE Standards Association: IEEE 754-2019: IEEE Standard for Floating-Point Arithmetic (catalogue page) Used for: That IEEE 754-2019 is the current standard and is sold, not free (the page offers "Purchase" and "Access via Subscription"). The text of the standard was not read for this site; the format facts below come from the secondary sources listed with it.
- Wikipedia: IEEE 754 Used for: Round to nearest, ties to even as the default; NaN split into quiet and signaling by the top fraction bit with the rest as payload; signed zero; the exponent field of all ones meaning infinity or NaN.
- Wikipedia: Single-precision floating-point format Used for: binary32 layout: 1 sign bit, 8 exponent bits with bias 127, 24-bit significand precision (23 stored), 6 to 9 significant decimal digits, and the hex patterns for the smallest subnormal (00000001), largest finite (7f7fffff) and their values.
- Wikipedia: Double-precision floating-point format Used for: binary64 layout: 11 exponent bits with bias 1023, 53-bit significand precision, 15 to 17 significant decimal digits.
- Oracle (reprint of D. Goldberg, ACM Computing Surveys, 1991): What Every Computer Scientist Should Know About Floating-Point Arithmetic Used for: Why 0.1 has no exact binary representation (it is an infinite repeating binary fraction); results exactly rounded using round to even; gradual underflow with denormalized numbers.
- Ecma International / TC39: ECMAScript Language Specification: Number type, bitwise shift operators and BigInt operations Used for: Number is IEEE 754 binary64; Number shifts convert with ToInt32 or ToUint32 and take the count modulo 32; BigInt left and right shift act on an infinite two's complement string; BigInt::unsignedRightShift throws a TypeError; strings are sequences of 16-bit code units.
- MDN Web Docs: Number Used for: Integers are exact only between -(2^53 - 1) and 2^53 - 1 (MAX_SAFE_INTEGER); about 15 to 17 significant decimal digits.
- MDN Web Docs: DataView Used for: DataView reads and writes big-endian by default although most platforms are little-endian. Used in the unit tests as an independent oracle for float encoding.
Every document above was opened and read on 2026-10-02. Documentation changes; if a page here disagrees with the current docs, trust the docs and tell us.
IEEE 754-2019 is not free (see the first entry), so it is cited here only as the existence of the standard; the explanations of the formats rely on the secondary sources that follow. The decoding and rounding code was tested against DataView, Float32Array and Float64Array on thousands of random bit patterns and decimal strings.