IEEE 754 Converter
Convert a decimal number to IEEE 754 single or double precision bits, hex, and stored value.
What it does
IEEE 754 is the standard binary format behind most floating point numbers in modern software. It stores a number in three parts: a sign bit, an exponent field, and a fraction field. The exponent is biased so the format can represent very small and very large values without a separate sign for the exponent.
Single precision uses 32 bits and double precision uses 64 bits. The extra bits in double precision buy a wider exponent range and far more fraction precision. Many languages call these float and double, although the exact type names and sizes vary by platform.
The default value 12.375 is positive and equals 1.546875 x 2^3. Its exponent field is 3 + 127 = 130, and its fraction is .546875. The 32 bits are 0 10000010 10001100000000000000000, which groups into the hexadecimal word 0x41460000.
Not every decimal number has an exact binary form. The decimal 0.1 becomes 0.100000001490116... in single precision and a slightly different value in double precision. The calculator shows the value actually stored after rounding, not the decimal you typed.
The tool covers normal numbers, subnormals, signed zero, infinity, and NaN. It displays the raw layout, but it does not show memory byte order. A hex dump may reverse the bytes on little-endian hardware, so the word 0x41460000 can appear as 00 00 46 41 in memory.
How to use
- Enter a decimal number, including scientific notation if needed.
- Choose single or double precision.
- Read the hexadecimal word first for a compact representation.
- Check the binary layout to see the sign, exponent, and fraction fields.
- Compare the stored value with the number you entered to see the rounding.
- Use the category field to identify normal, subnormal, zero, infinity, or NaN results.
Formula
- sign
- 0 for positive, 1 for negative.
- fraction
- Bits after the binary point in the significand.
- exponent field
- Stored exponent before the bias is removed.
- bias
- 127 for single precision, 1023 for double precision.
A normal number has an implicit leading 1 before the fraction. A subnormal number has an exponent field of zero and an implicit leading 0. All exponent bits set means infinity when the fraction is zero and NaN when the fraction is nonzero. The sign bit still applies to zero and infinity.
Worked example
Example: 12.375 in single precision
The default value and single precision setting are already selected.
- The number is positive, so the sign bit is 0.
- 12.375 / 8 = 1.546875, so the unbiased exponent is 3.
- Add the single precision bias: 3 + 127 = 130, which is 10000010 in binary.
- The fraction is 0.546875. In binary it is .100011, followed by zeros to fill 23 bits.
- Combine the fields: 0 10000010 10001100000000000000000.
- Group the 32 bits into four hex digits each: 0100 0001 0100 0110 0000 0000 0000 0000, or 0x41460000.
- The stored value is 12.375, so no rounding occurred.
Reference table
| Decimal input | Hex word | Stored value | Category |
|---|---|---|---|
| 12.375 | 0x41460000 | 12.375 | Normal |
| 0.1 | 0x3DCCCCCD | 0.100000001 | Normal |
| -2.5 | 0xC0200000 | -2.5 | Normal |
| 3.14159265 | 0x40490FDB | 3.141592741 | Normal |
| 16777217 | 0x4B800000 | 16777216 | Normal |
Limits
- The tool shows the numeric layout, not the byte order used in memory or on the wire.
- Single precision has about 7 significant decimal digits, so large integers and fine decimals can round.
- The sign and payload of a NaN are not preserved through ordinary decimal input.
- The converter does not handle decimal floating point, bfloat16, half precision, or extended precision formats.
Common mistakes
- Assuming the hex word is the same as the byte sequence stored in memory on a little-endian machine.
- Expecting 0.1 to be stored exactly when the format is binary.
- Using single precision for money or identifiers that need exact decimal digits.
- Reading the exponent field as the true exponent instead of subtracting the bias.
- Treating a subnormal result as zero without checking the category.
Try it yourself
Quick checks. Answers sit tucked under each question.
What is 0.1 in single precision?
The hex word is 0x3DCCCCCD and the stored value is 0.100000001. The exponent field is 123, or unbiased -4.
What is -2.5 in single precision?
The hex word is 0xC0200000, the sign is Negative, the exponent field is 128 (unbiased 1), and the significand is 1.25.
What happens to 16777217 in single precision?
It rounds to 16777216 and is stored as 0x4B800000. Single precision cannot represent every integer above 2^24.
Questions
What is IEEE 754?
A standard for binary floating point arithmetic. It defines how sign, exponent, fraction, rounding, infinity, and NaN are represented.
How many bits are in single and double precision?
Single precision uses 32 bits: 1 sign, 8 exponent, and 23 fraction. Double precision uses 64 bits: 1 sign, 11 exponent, and 52 fraction.
Why is the exponent biased?
The bias lets the format store negative exponents without a separate sign bit and leaves the all-zero and all-one patterns for subnormals and special values.
Why does 0.1 come back as 0.100000001?
0.1 has no finite binary expansion, so the nearest single precision value is slightly different. The display shows the stored value rounded to nine decimals.
What is a subnormal number?
A very small value with an exponent field of zero and no implicit leading 1. It trades precision for a gradual approach to zero.
Does this show little-endian bytes?
No. It shows the 32-bit or 64-bit word in numeric order. Byte order depends on the machine and how the value is serialized.
Sources
- NIST Digital Library of Mathematical Functions, floating point representation
- UCSD CSE 140, IEEE 754 floating point notes