IEEE 754 Floating-Point Converter

Decimal to IEEE 754 single and double precision bits.

Free IEEE 754 floating-point converter — turn a decimal number into its 32-bit single or 64-bit double precision representation and break out the sign, exponent and mantissa. Runs entirely in your browser. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is the difference between single and double precision?

Single precision (32-bit) uses 1 sign bit, 8 exponent bits and 23 mantissa bits. Double precision (64-bit) uses 1 sign bit, 11 exponent bits and 52 mantissa bits, giving far more range and roughly 15-17 significant decimal digits versus 6-9 for single.

IEEE 754 floating-point converter

Convert any decimal number into its IEEE 754 representation in 32-bit single or 64-bit double precision. IEEE 754 is the floating-point standard used by virtually every programming language and CPU, so this tool is handy for developers debugging precision bugs, students learning binary representation, and anyone curious why 0.1 + 0.2 is not exactly 0.3.

How it works

A floating-point number is split into three fields. The converter writes your value into a typed array (setFloat32 for single, setFloat64 for double) in big-endian order, then reads the raw bytes back as an unsigned integer to derive the hexadecimal and binary patterns. It then splits the binary into:

  • Sign bit — 1 bit; 0 is positive, 1 is negative.
  • Exponent — the stored (biased) exponent; subtract the bias (127 single / 1023 double) to get the real power of two.
  • Mantissa — the fraction bits (23 single / 52 double).
FieldSingle (32-bit)Double (64-bit)
Sign1 bit1 bit
Exponent8 bits (bias 127)11 bits (bias 1023)
Mantissa23 bits52 bits

Example

Entering 3.14159 in single precision yields hex 0x40490FD0, binary 01000000 01001001 00001111 11010000: sign 0 (positive), exponent 10000000 (unbiased 1), and a 23-bit mantissa. Because many decimals cannot be stored exactly in binary, the bits represent the nearest representable value.

Everything is computed locally in your browser — nothing is uploaded.

When to use single vs double precision

The choice between 32-bit and 64-bit matters both for what you are debugging and for what you are building:

  • Single (32-bit) — Use when checking values that will be stored or transmitted as float in C/C++/Java/C#, in GPU shader code, in 32-bit binary file formats (many scientific and image formats), or in machine-learning models that use fp16/fp32. Graphics code in particular defaults to float for performance.
  • Double (64-bit) — Use when working with JavaScript Number values (JavaScript always uses double internally), Python float, C double, or any general-purpose scientific computation. Double gives roughly twice the mantissa bits, which extends precision from about 7 significant digits to about 15.

Common precision pitfalls this converter reveals

Why 0.1 does not store exactly

Enter 0.1 in single precision and observe the mantissa: 00011001100110011001101 — a truncated binary repeating fraction. The stored value is not exactly 0.1 but the nearest representable float. In double precision the same issue exists but with 52 mantissa bits the rounding error is far smaller.

The 16777217 boundary

Enter 16777217 in single precision. It rounds to 16777216. This is because binary32 has 24 bits of significand (23 stored + 1 implied), so it can represent every integer up to 2²⁴ = 16,777,216 exactly. Beyond that, consecutive integers are more than one ULP apart and some cannot be stored. This is why integer counters stored as 32-bit floats silently stop incrementing above this value.

Negative zero

Enter -0 (or 0 with a negative sign). IEEE 754 defines a distinct negative zero: the sign bit is 1 and all other bits are zero. It compares equal to positive zero in most languages, but the bit patterns differ — the converter shows this clearly.

Infinity and NaN

Enter Infinity or -Infinity and observe all exponent bits set to 1 with mantissa zero. Enter NaN and see all exponent bits set to 1 with a nonzero mantissa. These special encodings are the standard mechanism for representing undefined results (division by zero, square root of a negative number) without crashing the program.

Reading the output fields

  • Hex: The 4-byte (32-bit) or 8-byte (64-bit) representation in hexadecimal, useful for embedding in binary files or comparing against a debugger’s memory view.
  • Binary: The full bit string, split into sign / exponent / mantissa for easy reading.
  • Sign bit: 0 = positive, 1 = negative.
  • Stored exponent: The raw unsigned integer in the exponent field, before bias subtraction.
  • Unbiased exponent: The true power of two (stored exponent minus bias — 127 for single, 1023 for double).
  • Mantissa: The fraction bits; the actual value of the significand is 1.mantissa for normal numbers.