IEEE 754 Converter Calculator
- IEEE 754 stores a floating-point number as three fields: one sign bit, a biased exponent, and a mantissa (fraction) whose leading 1 is implied for normal numbers. The layout is 1, 8 and 23 bits in single precision and 1, 11 and 52 in double precision.
- The value 1.50 encodes as 0x3FC0 0000. The sign bit is 0, the exponent field holds 127, and removing the bias of 127 gives the true exponent behind the value: 0.
- The mantissa bits are 1000 0000 0000 0000 0000 000. Read as a binary fraction after the implied leading 1, they are what actually pins the number down - and why 0.1, which has no finite binary expansion, is stored as a very close neighbour rather than exactly.
- Two patterns are reserved: an all-ones exponent with a zero mantissa means infinity, and with a nonzero mantissa it means a not-a-number result, from operations like zero divided by zero. An all-zero exponent marks zero and the subnormal numbers that fill the gap around it.
This IEEE 754 converter turns a decimal number into the exact bit pattern a computer stores for it, and turns a stored pattern back into the value it represents. IEEE 754 stores a float as a sign bit, a biased exponent and a mantissa with an implied leading 1: 1, 8 and 23 bits in single precision, 1, 11 and 52 in double. The calculator shows you each field separately, so you can see where every bit comes from. For example, 1.5 in single precision encodes as 0x3FC0 0000 — sign 0, exponent field 127, mantissa starting with a 1 bit. And -0.25 in double precision encodes as 0xBFD0 0000 0000 0000 — sign 1, exponent field 1021, an all-zero mantissa.
The method follows the IEEE 754 standard itself, which is why it is the accepted way to do this conversion: the fields are read and written exactly as the standard defines them, including its reserved cases. An all-ones exponent is reserved: with a zero mantissa it means infinity, with a nonzero mantissa a not-a-number result. The calculator also makes rounding visible. 0.1 in single precision encodes as 0x3DCC CCCD: one tenth has no finite binary expansion, so the stored value is a close neighbour, not exactly 0.1. On this page you will find the formula, step-by-step workings, worked examples and sources, so you can check every result by hand.
Worked examples
1.5 in single precision
1.5 in single precision encodes as 0x3FC0 0000. (1.5 · Single precision (32-bit))
| Hexadecimal bit pattern | 0x3FC0 0000 |
| Sign bit | 0 |
| Exponent field (biased) | 127 |
| Unbiased exponent | 0 |
| Mantissa bits | 1000 0000 0000 0000 0000 000 |
| Classification | Normal |
-0.25 in double precision
-0.25 in double precision encodes as 0xBFD0 0000 0000 0000. (-0.25 · Double precision (64-bit))
| Hexadecimal bit pattern | 0xBFD0 0000 0000 0000 |
| Sign bit | 1 |
| Exponent field (biased) | 1021 |
| Unbiased exponent | -2 |
| Mantissa bits | 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 |
| Classification | Normal |
0.1 in single precision
0.1 in single precision encodes as 0x3DCC CCCD - not exactly one tenth, just very close. (0.1 · Single precision (32-bit))
| Hexadecimal bit pattern | 0x3DCC CCCD |
| Sign bit | 0 |
| Exponent field (biased) | 123 |
| Unbiased exponent | -4 |
| Mantissa bits | 1001 1001 1001 1001 1001 101 |
| Classification | Normal |
The three fields
Every IEEE 754 float is built from three fields: a sign bit, a biased exponent and a mantissa. The mantissa carries an implied leading 1, which is why the format can store more precision than its bit count suggests. In single precision the split is 1 bit for the sign, 8 bits for the exponent and 23 bits for the mantissa. In double precision it is 1, 11 and 52. When you use an ieee 754 converter, these are the three pieces it pulls apart and puts back together.
The sign bit is the simplest of the three: 0 means positive and 1 means negative. The exponent is stored with a bias so that it can represent a wide range of magnitudes without needing a separate sign of its own. The mantissa holds the significant digits, and because the leading 1 is implied rather than stored, the 23 bits of a single actually give 24 bits of precision. Reading a hex value is mostly a matter of slicing it at those boundaries.
Worked examples make the layout concrete. In single precision, 1.5 encodes as 0x3FC0 0000: the sign is 0, the exponent field is 127, and the mantissa starts with a 1 bit. In double precision, -0.25 encodes as 0xBFD0 0000 0000 0000: the sign is 1, the exponent field is 1021, and the mantissa is all zeros. The same three fields, just at different widths.
Not every decimal number lands exactly on a representable value. In single precision, 0.1 encodes as 0x3DCC CCCD. One tenth has no finite binary expansion, so the stored value is a close neighbor, not exactly 0.1. That is why a converter may show a long string of digits when you type in a short decimal: you are seeing the nearest float, not the number you typed.
One exponent value is set aside for special cases. An all-ones exponent is reserved: with a zero mantissa it means infinity, and with a nonzero mantissa it means a not-a-number result. These encodings do not follow the normal implied-leading-1 rule, so a converter must treat them separately from ordinary values. Knowing where the three fields begin and end is the key to reading any float's hex form.
Reading the three examples
The fastest way to trust an IEEE 754 converter is to check its output against examples you can verify by hand. Each of the three bit patterns below breaks into the same three fields: a sign bit, a biased exponent, and a mantissa. The only difference is how many bits each field gets. Single precision splits its 32 bits into 1, 8 and 23, while double precision splits its 64 bits into 1, 11 and 52. In both formats the mantissa carries an implied leading 1, which is why the stored bits never show that first digit.
Start with 0x3FC0 0000, the single-precision encoding of 1.5. The leading hex digit 3 is 0011 in binary, so the sign bit is 0 and the value is positive. The next eight bits form the exponent field, which reads 127. Subtracting the single-precision bias of 127 gives an unbiased exponent of 0. The remaining 23 bits are the mantissa, and here it starts with a 1 bit. With the implied leading 1 restored, the significand is 1.1 in binary, and an exponent of 0 leaves it unscaled: 1.1 binary is 1.5 decimal. Every field agrees with the value.
Now take 0xBFD0 0000 0000 0000, the double-precision encoding of -0.25. The first hex digit B is 1011, so the sign bit is 1 and the value is negative. The next eleven bits give an exponent field of 1021; subtracting the double-precision bias of 1023 leaves an unbiased exponent of -2. The final 52 bits are the mantissa, and this one is all zeros. That is not an error: with the implied leading 1, an all-zero stored mantissa still means a significand of exactly 1.0. Scaling 1.0 by 2 to the power -2 gives 0.25, and the sign bit makes it -0.25.
The third pattern, 0x3DCC CCCD, is the single-precision encoding of 0.1, and it is the most instructive of the three. The sign bit is 0, so the value is positive. One tenth has no finite binary expansion, so no 23-bit mantissa can hold it exactly. The stored value is a close neighbour of 0.1, not exactly 0.1. A converter that printed a clean 0.1 without comment would be hiding the very rounding that makes this format worth studying, so run the bits through an IEEE 754 converter and read the decoded decimal with its full precision.
One field pattern deserves a separate warning. An all-ones exponent is reserved rather than an ordinary exponent. With a zero mantissa it means infinity, and with a nonzero mantissa it means a not-a-number result. None of the three examples above uses that pattern, but a converter should flag it whenever it appears.
Why 0.1 is not 0.1
A binary floating-point number cannot represent every decimal fraction exactly, and one tenth is the classic example. In base 10, 0.1 is a tidy terminating decimal. In base 2, it is a repeating fraction that never ends, like 1/3 in decimal. IEEE 754 has only a fixed number of bits to work with, so it stores the closest value it can and quietly discards the rest. That is why 0.1 in single precision encodes as 0x3DCC CCCD: one tenth has no finite binary expansion, so the stored value is a close neighbour, not exactly 0.1. An ieee 754 converter makes that gap visible, showing the exact bit pattern alongside the value that is actually stored.
The layout of a float explains where the precision goes. IEEE 754 stores a float as a sign bit, a biased exponent and a mantissa with an implied leading 1: 1, 8 and 23 bits in single precision, 1, 11 and 52 in double. Because the leading 1 is implied rather than stored, the mantissa effectively carries 24 bits of precision in single and 53 in double, but the spacing between representable values still grows as the exponent grows. Near 0.1, the nearest representable single-precision value sits a tiny distance away from the decimal we typed, and every subsequent operation works on that neighbour, not on one tenth.
Simple values behave more politely. 1.5 in single precision encodes as 0x3FC0 0000 - sign 0, exponent field 127, mantissa starting with a 1 bit. Because 1.5 is exactly representable, there is no rounding at all. The same is true of -0.25 in double precision, which encodes as 0xBFD0 0000 0000 0000 - sign 1, exponent field 1021, an all-zero mantissa. Halves and quarters are binary fractions, so they land precisely on the grid. Tenths, hundredths and most decimal fractions do not, which is why the trouble clusters around everyday decimal values rather than around values programmers pick to be clean.
Rounding to nearest softens the problem but does not remove it. When a decimal is converted, the hardware picks the closest representable value, breaking ties by a defined rule. The result is usually within half a unit in the last place, which is small in absolute terms but can be large in relative terms after repeated arithmetic. Add 0.1 ten times in single precision and the accumulated error can leave you a hair away from 1.0, so an equality test fails even though the math looks right on paper. The stored value is a close neighbour, and close is not the same as exact.
One more rule is worth knowing when you read raw bits. An all-ones exponent is reserved: with a zero mantissa it means infinity, with a nonzero mantissa a not-a-number result. That is why the exponent field never simply counts upward without limit, and why special values have their own patterns. When a calculation produces NaN, the bits tell you which case you hit.
Special values
Every IEEE 754 float is built from three fields: a sign bit, a biased exponent, and a mantissa with an implied leading 1. In single precision those fields are 1, 8 and 23 bits wide; in double precision they are 1, 11 and 52 bits. The normal encoding pattern is easy to see in a working example. The value 1.5 in single precision encodes as 0x3FC0 0000: sign 0, exponent field 127, and a mantissa starting with a 1 bit. The value -0.25 in double precision encodes as 0xBFD0 0000 0000 0000: sign 1, exponent field 1021, and an all-zero mantissa. An ieee 754 converter shows these fields side by side so you can check each one.
Not every pattern follows that implied-leading-1 rule. When the exponent field is all zeros, the number is either zero or subnormal. A zero mantissa with a zero exponent field gives zero, and the sign bit still matters, which is why the standard has both +0 and -0. A nonzero mantissa with an all-zero exponent field gives a subnormal number: a value smaller than the smallest normal float, stored with reduced precision. Subnormals let the format represent numbers just below the normal range instead of dropping straight to zero.
At the other end, an all-ones exponent field is reserved. With a zero mantissa it means infinity, and the sign bit selects positive or negative infinity. With a nonzero mantissa it means not-a-number, or NaN, which is how the format reports a result that is not a valid number, such as an undefined operation. These reserved patterns are why the exponent range is not simply used end to end for ordinary values.
Special values are not edge-case clutter; each one carries a purpose. Zero gives an exact additive identity. Subnormals extend the range of representable magnitudes near zero, trading precision for the ability to hold very small values. Infinities represent overflow and the results of operations that exceed the largest finite value, and they propagate through later arithmetic in a predictable way. NaN marks an invalid result so it can travel through a computation without being mistaken for a real number. Finally, the standard itself is a reminder that most decimal fractions cannot be stored exactly: 0.1 in single precision encodes as 0x3DCC CCCD, because one tenth has no finite binary expansion, so the stored value is a close neighbour rather than exactly 0.1.
FAQs
What is IEEE 754?
IEEE 754 is the standard binary floating-point format. Each number is stored in three parts: a sign bit, a biased exponent field and a mantissa field. The sign bit records positive or negative, the exponent field sets the scale, and the mantissa holds the significant bits of the value.
How is 1.5 stored in single precision?
In single precision, 1.5 is stored as 0x3FC0 0000. The sign bit is 0, so the value is positive. The exponent field is 127, which is unbiased 0. The mantissa is 1000 followed by zeros, giving the fractional part of one half.
Why is 0.1 inexact in a computer?
One tenth is an infinitely repeating binary fraction, so it cannot be stored exactly in a fixed number of bits. Single precision stores 0x3DCC CCCD, the nearest representable value. That stored value is extremely close to 0.1 but not identical to it, so tiny rounding differences can appear.
What is the exponent bias?
The exponent bias is 127 in single precision and 1023 in double precision. It is subtracted from the stored exponent field to get the true exponent. For the -0.25 example, the true exponent is -2. The bias lets the format represent both very small and very large magnitudes without a separate sign for the exponent.
What do all-ones exponent fields mean?
When the exponent field is all ones, the meaning depends on the mantissa. With a zero mantissa, the value is infinity, positive or negative according to the sign bit. With a nonzero mantissa, the value is a not-a-number result, used to signal an undefined or invalid operation.
Single or double precision?
Double precision, 64 bits, is the default in most languages. Its 52 mantissa bits give about 15 to 17 significant decimal digits, far more than single precision provides. Choose single precision only when memory or storage savings matter more than that extra precision and range.