IEEE 754 Floating Point Converter
Convert decimal, hex or binary as a 32-bit float or 64-bit double. Inspect the stored bits and rounding error.
Inspect & edit bits
Most significant firstSelect a group to highlight Binary. Click a bit, or press Space, to toggle it.
Enter a value to inspect its bits.
Exact decimal & rounding
- Exact stored value
- Stored − input
Byte order
- Big-endian bytes
- Little-endian bytes
Two’s complement calculation steps
Enter a valid integer to see the calculation steps.
For worked examples and signed ranges, open the two’s complement calculator. Your existing integer bookmarks still work here.
Your decimal input is kept as entered. The stored value shows the nearest representable number.
Bit inspector inspired by H. Schmidt’s IEEE-754 Floating Point Converter.
/usage
Decimal to IEEE 754, and IEEE 754 to decimal
- Choose 32-bit single precision or 64-bit double precision.
- Edit Decimal to encode a number, or paste a complete hex or binary bit pattern to decode it. The other fields update immediately.
- Inspect the sign, exponent and fraction bits. Open Exact decimal & rounding to compare the stored value with your input, or Byte order to copy the encoded bytes.
Hexadecimal means the encoded bits: 3F800000 is float32 1. Hex input accepts spaces, underscores and a 0x prefix, with exactly 8 digits for float32 or 16 for float64. Byte order shows both endian layouts; hex input is the complete word in most-significant-byte-first order.
Bookmarks keep the width and compact Values or Bits view, without saving your number. Existing #float and #twos-complement bookmarks remain supported. For signed binary and integer conversions, use the dedicated two’s complement calculator.
/examples
Why 0.1 differs in float32 and float64
The binary expansion of 0.1 repeats, so neither format stores it exactly. Both round to the nearest representable value, with ties going to an even significand.
| Format | Hex bits | Exact stored decimal |
|---|---|---|
| Float32 / single | 3DCCCCCD | 0.100000001490116119384765625 |
| Float64 / double | 3FB999999999999A | 0.1000000000000000055511151231257827021181583404541015625 |
For float32, sign 0, exponent 01111011 and fraction 10011001100110011001101 encode the result. The exponent field is 123; subtracting the bias 127 gives −4. The stored value exceeds 0.1 by 0.000000001490116119384765625.
/formats
Sign, exponent and mantissa
| Format | Sign | Exponent / bias | Fraction (mantissa) |
|---|---|---|---|
| Float32 / binary32 | 1 bit | 8 bits / 127 | 23 bits |
| Float64 / binary64 | 1 bit | 11 bits / 1023 | 52 bits |
A normal value is (−1)^sign × (1 + fraction / 2^fractionBits) × 2^(exponent − bias). The leading 1 is implicit. Subnormal values use a leading 0 and the minimum normal exponent instead.
Decimal input is rounded directly from its digits using integer arithmetic, avoiding an intermediate float64 rounding before float32 conversion. Inspect the complete stored decimal and signed conversion error under Exact decimal & rounding. Reference: Oracle’s IEEE arithmetic guide.
/special-values
Negative zero, NaN and subnormal values
Positive and negative zero have different sign bits. Infinity has an all-ones exponent and a zero fraction; NaN has an all-ones exponent and a nonzero fraction. Raw NaN payload bits are preserved when you enter hex or binary. This tool supports binary32 and binary64.
| Float32 value | Hex bits | Meaning |
|---|---|---|
| 1.5 | 3FC00000 | Exactly representable |
| −0 | 80000000 | Only the sign bit is set |
| +Infinity | 7F800000 | All exponent bits set |
| Smallest positive subnormal | 00000001 | 2^−149 |