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).
| Field | Single (32-bit) | Double (64-bit) |
|---|---|---|
| Sign | 1 bit | 1 bit |
| Exponent | 8 bits (bias 127) | 11 bits (bias 1023) |
| Mantissa | 23 bits | 52 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.