digiwleea Tools
Learn Open the lab →

IEEE 754 floating point converter

Turn a decimal number into its IEEE 754 bit pattern at single (32-bit) or double (64-bit) precision, or paste a hex pattern to decode it, with the sign, exponent (raw and unbiased), and mantissa broken out and the full bit string colour-coded. Special values (zero, infinity, NaN, and subnormals) are named. The conversion is exact: the browser's own floating-point hardware does it, the same way your CPU does.

How to use it

Pick 32-bit or 64-bit precision, then type a number in the Decimal value box, including scientific notation like 1e10, or the words inf and nan. The Bit pattern box updates with the hex encoding, and you can type a pattern there instead (0x hex or 0b binary) to decode it back to a value. The breakdown shows each field, and the coloured bit string maps every bit to the sign, exponent, or mantissa it belongs to.

How IEEE 754 works

A floating point number is stored like scientific notation in binary: value = sign x 1.mantissa x 2^(exponent - bias). The sign is one bit. The exponent is stored with a bias added (127 for 32-bit, 1023 for 64-bit) so it is always non-negative; subtract the bias to get the real power of two. The mantissa holds the fraction after an implied leading 1. for normal numbers. This is why the same fixed number of bits can span both enormous and tiny magnitudes, trading exactness for range.

Why 0.1 + 0.2 is not 0.3

Type 0.1 at 64-bit and you get 0x3FB999999999999A, which is really 0.1000000000000000055.... The value 0.1 has no exact binary representation (just as 1/3 has no exact decimal one), so it rounds to the nearest representable number. Add two such rounded values and the small errors can survive, which is the famous reason 0.1 + 0.2 prints as 0.30000000000000004 in most languages. Fixed-point avoids this for money; see fixed-point and floating point.

Frequently asked

How does IEEE 754 store a number?

As three fields: a sign bit, a biased exponent, and a fractional mantissa, meaning sign times 1.mantissa times 2 to the (exponent minus bias). A 32-bit float uses 1, 8 (bias 127), and 23 bits; a 64-bit double uses 1, 11 (bias 1023), and 52.

What is 0.1 in IEEE 754?

0.1 has no exact binary form, so it is stored as the nearest value: 0x3DCCCCCD (about 0.100000001) in 32-bit, or 0x3FB999999999999A (about 0.1000000000000000055) in 64-bit. That rounding is why 0.1 + 0.2 is not exactly 0.3.

Why is the exponent biased?

Adding a bias (127 or 1023) keeps the stored exponent non-negative, so one unsigned comparison orders both tiny and huge magnitudes. Subtract the bias to recover the real exponent.

How are infinity and NaN stored?

Both use an all-ones exponent: an all-zero mantissa is infinity (the sign bit picks the direction), a non-zero mantissa is NaN. An all-zero exponent with a non-zero mantissa is a subnormal, for values below the smallest normal number.

Floating point is how computers hold real numbers. Read the floating point lesson and its cousin fixed-point, or open the lab and build the integer arithmetic it is layered on.

Related tools: binary converter, two's complement calculator, and bitwise calculator.

Open the lab →

Embed this tool

Free to embed in your course page, blog, or notes: just keep the credit link under the widget. Paste this where you want it:

<iframe src="https://digiwleea.wleeaf.dev/embed/tool/?w=float" width="100%" height="520" style="border:0;border-radius:12px;max-width:720px" title="IEEE-754 float converter" loading="lazy"></iframe>