Decimal to IEEE 754 single precision (float32)

For programmers and embedded engineers who need to see what a float really holds, and why 0.1 is not exactly 0.1.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter decimal number.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

Value = (-1)^S × 1.F × 2^(E - 127), with a sign bit S, an 8-bit exponent E and a 23-bit fraction F. The number is rounded to the nearest representable value, ties to even.

Example

Inputs: Decimal number = 0.1. Result: Hex encoding: 0x3DCCCCCD; Value class: Normal.

0.1
0x3DCCCCCD

Limits and caveats

  • Infinity, -Infinity and NaN are accepted; NaN uses the standard quiet pattern 0x7FC00000.
  • The stored value and the error are written out exactly and can be long.

Questions about this tool

What is 0.1 in float32?

0x3DCCCCCD. The stored value is 0.100000001490116119384765625 because 0.1 has no finite binary form.

What is the largest float32?

About 3.4028235 × 10³⁸, encoded 0x7F7FFFFF. Anything larger after rounding becomes Infinity.

How many decimal digits does float32 keep?

About 7 significant digits, since its significand is 24 bits including the hidden bit.