Number Base Converter

Whole numbers only. Optional matching prefixes: 0b, 0o or 0x.

Enter a whole number to compare its representations.

Decimal
Binary
Octal
Hexadecimal

Magnitude bit explorer

Enter a valid integer to explore its magnitude bits.

Show place values

window contribution = Σ(bitᵢ × 2ⁱ)

    Calculation needs JavaScript. If it does not load, the instructions and formulas below remain available.

    Convert signed whole numbers between decimal, binary, octal and hexadecimal, and explore how each bit contributes to the value.

    How to use

    Choose the base of your input, then enter a whole number. Binary uses 0–1, octal 0–7, decimal 0–9 and hexadecimal 0–9 plus A–F.

    Optional 0b, 0o and 0x prefixes must match the selected base. A leading plus or minus sign is allowed; fractional values and separators are not.

    Read the same integer in all four result rows. Copy one representation or copy all four labeled values.

    Use the bit explorer to turn a magnitude bit on or off. Higher bits and Lower bits move the visible window without changing the number.

    Open Show place values for the contribution of the visible bits. Reset clears the input and restores the starting base.

    Science

    A positional number system assigns each digit a weight based on its position. In base b, the weights are 1, b, b² and so on. Changing the base changes the written representation, not the integer.

    Binary uses two digits, octal uses eight and hexadecimal uses sixteen. One hexadecimal digit corresponds to four binary bits; one octal digit corresponds to three bits.

    This tool keeps integer arithmetic exact within its 4,096-bit magnitude limit. It does not pass large integers through binary floating-point Number values.

    A negative integer is displayed with a minus sign and its magnitude in every base. The bit explorer is not a fixed-width signed machine representation and does not infer two’s complement.

    Formulas

    Positional value: N = sign × Σ(dᵢ × bⁱ)

    Binary magnitude: magnitude = Σ(bitᵢ × 2ⁱ)

    Hexadecimal grouping: 1 hexadecimal digit = 4 binary bits

    Octal grouping: 1 octal digit = 3 binary bits

    Examples

    255 in decimal: 11111111 binary; 377 octal; FF hexadecimal. Eight set bits have weights 128 through 1, which add to 255.

    -42 in decimal: -101010 binary; -52 octal; -2A hexadecimal. The minus sign is separate from the magnitude.

    0x1000000000000000 in hexadecimal: 1152921504606846976 decimal. Exact integer conversion does not depend on Number's safe-integer limit.

    0000 in decimal: 0 in every base. Leading zeros are normalized.

    References

    ECMAScript: BigInt values and radix formatting

    MDN: BigInt precision and operations