Start a project

Tool 163 of 194 · Numbers

IEEE 754 & Bitwise Inspector

Find out exactly what a float stores: the sign, exponent and fraction bits, the exact decimal value and how far it is from the number you typed.

IEEE 754 & Bitwise Inspector

Floating point

Try 0.1, 16777217, 65520, 0x3FB999999999999A or 1e-8.

float64 bits: sign exponent fraction

FormatBits (hex)Sign, exponent, fractionStored value (shortest)Error vs your numberKind
    Exact value of the float64

    Integers and byte order

    WidthSignedUnsignedHexBig-endian bytesLittle-endian bytes

    Negative numbers are stored as two's complement: the bits of 2n minus the size. Big-endian puts the most significant byte first (network order); x86 and ARM store little-endian.

    01

    What it does

    Rounds a number to float64, float32, float16 and bfloat16, shows each bit pattern, the exact stored value and the error, and lays out integers in two's complement.

    • float64, float32, float16 and bfloat16, rounded half to even from the float64 value
    • Sign, exponent and fraction bits, and the hex pattern
    • The exact decimal value stored, computed with BigInt
    • The error against the decimal you typed, and overflow, underflow and subnormal warnings

    02

    Private by design

    Everything happens in your browser. Nothing you type, paste or upload is sent anywhere, and it keeps working offline once the page has loaded.

    03

    What you get

    Bit patterns, exact values and errors for four float formats, plus integer bytes, with a Copy and a Download button on every result.

    • IEEE 754
    • Floating point
    • Binary
    • Numbers

    Why it matters

    Computers store most numbers in binary floating point, which can't represent 0.1 exactly. The nearest float64 is a little above 0.1, the nearest to 0.2 is a little above 0.2, and their sum rounds to a value just above the float64 nearest 0.3, so 0.1 + 0.2 === 0.3 is false. Narrower formats lose far more: float16 can't store 2049, and bfloat16, popular in machine learning, keeps only about three significant digits.

    This inspector shows every bit. It rounds your number to each format with the round-half-to-even rule IEEE 754 uses, prints the exact decimal value that is stored (every finite float is an exact, if long, decimal), and measures the error. The rounding was checked against NumPy on over 800 values with no differences.

    How to use it

    1. Type a number, a hex bit pattern such as 0x3FB999999999999A, or a sum such as 0.1 + 0.2.
    2. Read the bit pattern and stored value for each format.
    3. Check the error and any overflow or subnormal warnings.
    4. Enter a whole number below to see its two's complement bytes.

    FAQ

    Why is 0.1 + 0.2 not 0.3?

    Neither 0.1 nor 0.2 is exact in binary. Their stored values add up to slightly more than the float64 nearest to 0.3, so the result is 0.30000000000000004.

    What is bfloat16?

    A 16-bit format with float32's 8-bit exponent but only 7 fraction bits. It has the same range as float32 with much less precision, which suits neural network training.

    What is a subnormal number?

    A value smaller than the smallest normal number, stored with a zero exponent so it can get closer to zero, at the cost of precision.

    What is two's complement?

    The usual way to store signed integers: a negative number n in w bits is stored as 2^w + n, so -1 is all ones and adding works the same for signed and unsigned values.

    Work with me

    Want a site that gets these right?

    I build fast, accessible websites and web apps that pass these checks from day one. Tell me about your project and I'll reply personally with honest next steps.

    All developer tools · Back to leej.uk