IEEE 754 floating point converter

Type a decimal number to see how a computer stores it as a 32-bit float or 64-bit double: the bit pattern in binary and hex, the exact value that gets stored and how far it is from what you typed. You can also paste hex or binary bits to decode them.

Show the working
Accepts 0.1, -2.5, 6.02e23, Infinity and NaN.

Runs in your browser. Nothing you type is uploaded.

How to use the IEEE 754 converter

  1. Pick 32-bit (float) or 64-bit (double) in Precision.
  2. Type a number such as 0.1, -2.5 or 6.02e23. Infinity and NaN work too.
  3. Read the colored bits: one sign bit, then the exponent, then the mantissa. Click any bit to flip it and see the new value.
  4. To decode, set Input to Hex bits or Binary bits and paste a pattern such as 3DCCCCCD. Inside a file, the hex editor reads 4 selected bytes as a float too.

"Value actually stored" is the exact decimal value of the bits, with every digit. The rounding error card shows the gap between that and what you typed.

How IEEE 754 stores a number

IEEE 754 single precision layout for 5.75: sign bit 0, exponent 10000001 which is 129 or 2 plus the bias of 127, mantissa 0111 followed by zeros. The 32 bits are 40B80000 in hex.

IEEE 754, the floating-point standard, writes a number in binary scientific notation, like 1.0111 × 22, and stores three parts of it:

Part32-bit float64-bit doubleHolds
Sign1 bit1 bit0 for positive, 1 for negative
Exponent8 bits, bias 12711 bits, bias 1023The power of 2, plus the bias
Mantissa23 bits52 bitsThe digits after the leading 1
Precisionabout 7 decimal digitsabout 15 to 17 digits

The leading 1 is never stored because a normal binary number in this form always starts with 1. That free bit is why a float has 24 bits of precision from 23 stored bits.

Worked example: 5.75 to 32-bit

  1. 5.75 is positive, so the sign bit is 0. A negative float only flips this bit, while whole numbers use two's complement instead.
  2. In binary, 5 is 101 and 0.75 is .11, so 5.75 is 101.11.
  3. Move the point two places left: 1.0111 × 22.
  4. Add the bias: 2 + 127 = 129, which is 10000001 in 8 bits.
  5. Drop the leading 1 and pad the rest to 23 bits: 01110000000000000000000.

Put together: 0 10000001 01110000000000000000000, which is 40B80000 in hex, as hex to binary confirms digit by digit. 5.75 fits exactly, so the rounding error is 0.

Why 0.1 is not exact

In binary, 0.1 repeats forever (0.000110011001100...), the way 1/3 repeats in decimal, as Python's floating-point tutorial shows. A float has to cut it off. The nearest 32-bit value is 3DCCCCCD, which is exactly 0.100000001490116119384765625. In Python, struct.pack('>f', 0.1).hex() returns '3dcccccd', as the Python struct guide explains. As a double it is 3FB999999999999A, a bit closer but still not 0.1. This is why 0.1 + 0.2 prints 0.30000000000000004 in JavaScript and Python, which our guide to floating point numbers explains along with float vs double.

Why 0.1 is not exact in floating point: in binary it repeats forever, so a 32-bit float stores 3DCCCCCD, which is 0.100000001490116119384765625, and a 64-bit double stores 3FB999999999999A, which is slightly above 0.1.

Special values

Exponent bitsMantissaMeaning32-bit hex
All 0All 0Zero (sign bit gives +0 or -0)00000000 / 80000000
All 0Not 0Subnormal, very small numbers with no hidden 100000001 is about 1.4e-45
All 1All 0Infinity7F800000 / FF800000
All 1Not 0NaN, not a number7FC00000

The largest 32-bit float is about 3.4 × 1038 and the largest double is about 1.8 × 10308. Anything bigger becomes infinity.

Frequently asked questions

What is IEEE 754?

It is the standard for storing decimal numbers in binary, used by almost every processor and programming language. It was first published in 1985.

What is the difference between single and double precision?

Single (float) uses 32 bits and keeps about 7 digits. Double uses 64 bits and keeps about 15 to 17 digits, with a far larger range.

How do I convert hex to float?

Set Input to Hex bits and paste the 8 hex digits for a float or 16 for a double. The decimal value appears at once.

Why is the exponent biased?

The bias lets the exponent be stored as a plain unsigned number, so negative powers need no sign bit and floats can be compared like integers.

Scroll to Top