What IEEE-754 conversion reveals
IEEE-754 is the dominant binary floating-point standard used by JavaScript, most programming languages, processors, file formats, and network protocols. Unlike an integer, a floating-point pattern is divided into a sign bit, a biased exponent, and a fraction field often called the mantissa. The arrangement allows an enormous range of magnitudes, but only a finite number of significant binary digits, which is why many simple decimal fractions cannot be stored exactly.
This tool shows the complete 32-bit float32 or 64-bit float64 pattern rather than only a rounded decimal result. It also decodes an exact binary or hexadecimal pattern without discarding its field layout. Special values—including positive and negative infinity, NaN, positive zero, negative zero, and subnormal numbers—are classified from their exponent and mantissa bits.
How to use the IEEE-754 converter
Start with the representation you trust most: a decimal value from an application, or exact bits from a file, register, packet, or specification.
- Choose float32 for a 32-bit single-precision value or float64 for a 64-bit double-precision value.
- Select Decimal, Exact binary pattern, or Exact hexadecimal pattern as the input representation.
- Enter the value. Binary requires exactly 32 or 64 bits; hex requires exactly 8 or 16 digits. Decimal accepts exponent notation plus NaN, Infinity, -Infinity, and -0.
- Press Calculate to inspect the complete pattern and the separate sign, exponent, and mantissa fields.
- Compare the decoded decimal with the original expectation. For float32, the browser first rounds the decimal input to single precision, so the displayed value can differ from what you typed.
IEEE-754 examples
Known vectors make it easier to verify byte order, field boundaries, and special-value handling.
| Input | Encoded pattern | Explanation |
|---|---|---|
| 1.0 float32 | 3F800000 | Sign is 0, stored exponent is 127, and the fraction is zero, giving exactly 1×2⁰. |
| -2.5 float32 | C0200000 | The sign bit is 1; the normalized significand is 1.25 with an unbiased exponent of 1. |
| -0 float32 | 80000000 | Negative zero has the sign bit set while exponent and mantissa remain zero. |
| Infinity float32 | 7F800000 | An all-ones exponent with a zero mantissa represents positive infinity. |
| NaN float32 | 7FC00000 example | An all-ones exponent with a nonzero mantissa represents NaN; many payload patterns are possible. |
| Smallest positive subnormal float32 | 00000001 | Exponent is zero and only the lowest mantissa bit is set, producing approximately 1.40129846×10⁻⁴⁵. |
Accepted values and exact widths
Decimal input accepts standard finite decimal syntax with an optional sign, decimal point, and e exponent. It also accepts NaN, Infinity, -Infinity, Inf, -Inf, and signed zero. For float32, decimal input is rounded using the platform’s IEEE-754 single-precision conversion. For float64, JavaScript Number already uses double precision.
Binary and hexadecimal modes represent the stored pattern directly. They do not parse a mathematical base-2 fraction. Spaces and underscores are ignored for readability, but the remaining width must be exact. Hex is shown in big-endian display order: the leftmost digit contains the sign bit.
- float32 uses 1 sign bit, 8 exponent bits, and 23 mantissa bits.
- float64 uses 1 sign bit, 11 exponent bits, and 52 mantissa bits.
- Binary input requires 32 or 64 bits; hex requires 8 or 16 digits.
- NaN payload bits are retained when decoding a supplied binary or hexadecimal pattern.
How IEEE-754 values are encoded
For normal finite values, the mathematical form is (-1)ˢ × (1.fraction) × 2ᵉ. The stored exponent is the real exponent plus a bias: 127 for float32 and 1023 for float64. The leading 1 of a normal binary significand is implicit, so only the fractional bits after it are stored.
When the stored exponent is zero, a zero mantissa represents signed zero. A nonzero mantissa represents a subnormal value with no implicit leading one and an exponent fixed at 1-bias. Subnormals provide gradual underflow near zero, trading precision for the ability to represent magnitudes smaller than the smallest normal value.
When every exponent bit is one, a zero mantissa represents infinity and a nonzero mantissa represents NaN. The converter builds and reads the bit patterns through DataView using big-endian display order, then classifies values from the raw fields so -0 and NaN are not lost through ordinary string conversion.
Practical uses
A field-level view is valuable whenever a decimal result alone cannot explain a floating-point behavior.
Debug precision surprises
Inspect why 0.1, currency-like values, or accumulated calculations differ by a small amount after binary rounding.
Decode files and protocols
Translate 32-bit or 64-bit fields from binary formats, device messages, graphics data, scientific files, or packet captures.
Verify test vectors
Check known hexadecimal constants, serialization code, endian conversions, and edge-case handling across languages.
Study numerical computing
Explore normal ranges, subnormal transitions, signed zero, infinity, NaN, exponent bias, and significand precision.
Common mistakes and edge cases
Floating-point patterns are exact, but the decimal text used to describe them can be rounded or ambiguous.
Expecting decimal fractions to be exact
Most decimal fractions have repeating binary expansions. The nearest representable value can be slightly above or below the text you entered.
Mixing float32 and float64
The same decimal usually has different stored patterns and precision. A 32-bit pattern cannot be decoded as a 64-bit pattern without changing its meaning.
Ignoring negative zero
0 and -0 compare equal in many operations but have different sign bits and can affect reciprocals, branch behavior, and some numerical algorithms.
Treating every NaN as one pattern
IEEE-754 permits many NaN payloads. Decoding preserves the supplied fields, but converting the decimal word NaN uses the platform’s canonical NaN representation.
How this differs from other numeric tools
IEEE-754 conversion is about floating-point storage, not integer notation.
Two’s complement
Two’s complement stores fixed-width signed integers. IEEE-754 uses separate sign, exponent, and fraction fields and has special non-finite values.
Binary calculator
The binary calculator performs exact integer arithmetic. IEEE-754 operations are rounded to a finite significand and follow special-value rules.
Base converter
A base converter rewrites a mathematical integer. An IEEE hex pattern is a storage encoding whose bits must be split into fields before it has a floating-point meaning.
Hex byte converter
Text/hex conversion interprets bytes as UTF-8 characters. IEEE conversion interprets the same bytes as a floating-point bit layout.