Hex to Float & IEEE 754 Converter
Convert a hex or binary bit pattern to the float it encodes, and any decimal number to its IEEE 754 bits. Convert in both directions - decimal to IEEE 754 bits, or a hex/binary bit pattern back to the exact float it encodes.
0x40091EB851EB851F3.1401000000000010010001111010111000010100011110101110000101000111113.140000000000000124344978758017532527446746826171875Bit breakdown (64-bit IEEE 754 binary64)
- Sign
- Positive
- Exponent (11 bits)
- 1024 raw, 1 actual
- Mantissa (52 bits)
- 0x91EB851EB851F
- Class
- Normal
Bias for binary64 is 1023, so the stored exponent field is the actual exponent plus 1023.
Reference encodings
Select any row to load that bit pattern into the converter above.
| Value | 32-bit hex | 64-bit hex |
|---|---|---|
| 1.0 | ||
| -2.5 | ||
| 0.1 | ||
| Infinity | ||
| -Infinity | ||
| NaN | ||
| 0 | ||
| -0 |
How a float is stored
IEEE 754 splits a float into three fields: one sign bit, an exponent (11 bits at this precision), and a mantissa or significand (52 bits). The value is roughly sign x 1.mantissa x 2^(exponent - 1023). The leading 1 is implied for normal numbers, which buys one extra bit of precision for free.
Because the mantissa is finite and binary, most decimal fractions cannot be stored exactly. The exact stored value field above shows the full decimal expansion of the bits actually held in memory - which is why 0.1 reads as 0.1000000000000000055511151231257827... rather than 0.1.
Code Examples
// Get IEEE 754 bits of a float
function floatToBits(f) {
const buffer = new ArrayBuffer(4);
new Float32Array(buffer)[0] = f;
return new Uint32Array(buffer)[0];
}
floatToBits(1.0).toString(2).padStart(32, '0');
// "00111111100000000000000000000000"Frequently Asked Questions
How do I convert hex to float?
Paste the hex bit pattern and pick the matching width: 8 hex digits for a 32-bit float, 16 for a 64-bit double. The converter reinterprets those bytes as IEEE 754 and shows the decimal value. For example 0x40490FDB is 3.14159274101257 as a 32-bit float, and 0x400921FB54442D18 is 3.141592653589793 as a double.
Why does 0.1 + 0.2 !== 0.3?
0.1 and 0.2 cannot be exactly represented in binary floating point (like 1/3 in decimal). The small representation errors accumulate, giving 0.30000000000000004.
What is the difference between float and double?
A float (binary32) uses 1 sign bit, 8 exponent bits and 23 mantissa bits, giving about 7 decimal digits of precision. A double (binary64) uses 1 sign bit, 11 exponent bits and 52 mantissa bits, giving about 15-17 digits. The same hex pattern means completely different values at the two widths.
What are the special IEEE 754 values?
Infinity (exponent all 1s, mantissa 0), -Infinity, NaN (exponent all 1s, mantissa non-zero), denormalized numbers (exponent all 0s for very small values).
Does byte order affect the hex pattern?
Yes. This page uses big-endian (network) order, which is how IEEE 754 patterns are conventionally written. If your bytes came from a little-endian memory dump, reverse them first - the endianness converter does this in one step.
Related Tools
Decimal to Binary Converter
Convert decimal numbers to binary (base 2) instantly.
Two's Complement Calculator
Calculate two's complement representation for signed integers.
Bytes to Int Converter
Convert hex bytes to signed or unsigned integers using big-endian or little-endian byte order.
Endianness Converter
Swap byte order between big-endian and little-endian, and read the same bytes as an integer both ways.
This tool runs entirely in your browser - nothing you enter is uploaded or stored.