IEEE 754 Floating Point Converter
Encode any decimal number into its IEEE 754 floating point bit pattern for half, single or double precision, or decode a hex or binary pattern back to its exact value. The sign, exponent and mantissa fields are broken out, with the rounding error shown.
How to convert a number to IEEE 754
- Pick a precision: half (16 bit), single (32 bit) or double (64 bit).
- Type a decimal number, or Infinity, -Infinity or NaN.
- Read the sign, exponent and mantissa bits, the hex and the rounding error.
- Switch to decode mode to turn a hex or binary pattern back into a value.
Examples
Encode 0.1 in single precision
Value 0.1, single precision
Hex 0x3DCCCCCD, not exact (stored as ~0.100000001)
Encode 1.0 in double precision
Value 1, double precision
Hex 0x3FF0000000000000, exponent 0, mantissa 0
Frequently asked questions
What is IEEE 754?
IEEE 754 is the standard that defines how computers store floating point numbers. A value is split into a sign bit, a biased exponent and a mantissa, giving half, single and double precision formats.
Why is 0.1 not stored exactly?
0.1 has no finite binary fraction, so it is rounded to the nearest value the format can hold. This tool shows the stored value and the exact rounding error, which is why 0.1 plus 0.2 is not exactly 0.3.
What is the difference between single and double precision?
Single precision uses 32 bits (8 exponent, 23 mantissa) for about 7 decimal digits. Double precision uses 64 bits (11 exponent, 52 mantissa) for about 15 to 17 digits. Half uses 16 bits for low precision storage.
How does the exponent bias work?
The stored exponent is the real exponent plus a bias: 127 for single, 1023 for double and 15 for half. So a stored exponent field of 128 in single precision means a real exponent of 1.
What are subnormal numbers and NaN?
When the exponent field is all zeros the number is zero or subnormal, filling the gap near zero. When it is all ones the value is Infinity (mantissa zero) or NaN (mantissa non-zero). The tool labels each case.
Does rounding follow a specific rule?
Yes, it uses round to nearest, ties to even, the IEEE 754 default. The encoder is computed with exact integer math so the bits match what your CPU produces.
Related tools
Twos Complement Calculator
Convert a signed integer to its twos complement binary and hex for any bit width. Also decodes a twos complement bit pattern back to a signed value.
Number Base Converter
Convert numbers between any base from 2 to 36, including binary, octal, decimal and hex. Handles huge numbers exactly with arbitrary precision. Free, private.
Hex to Decimal
Convert hex to decimal online. Paste a hexadecimal value, with or without a 0x prefix, and get the exact base 10 number. Runs in your browser.
Decimal to Binary
Convert decimal numbers to binary online. Type a whole number and get its base-2 value instantly, even for very large numbers. Runs in your browser.
Bitwise Calculator
Bitwise AND, OR, XOR, NOT, NAND, NOR, XNOR and shifts on 8, 16, 32 or 64 bit integers. See results in binary, hex, octal and decimal.
.env to JSON
Convert a .env file to JSON, or JSON back to .env. Parses KEY=value lines, comments, quotes and export. Runs entirely in your browser.