Skip to main content

OTHER · BASE CONVERTER

Base Converter Calculator

Convert numbers between binary, octal, decimal, and hexadecimal — instantly. Handles 64-bit integers correctly using BigInt (no precision loss above 2^53).

Input Base
Value

e.g. 255 or −5

02 Result
Binary (2)11111111
Octal (8)377
Decimal (10)255
Hex (16)FF

About This Calculator

Enter any number in binary (base 2), octal (base 8), decimal (base 10), or hexadecimal (base 16) and see the equivalent in all other bases instantly. Handles 64-bit integers exactly using BigInt — no precision loss for values above 2^53.

How It Works

Choose the input base, enter a value, and the calculator converts it to all other bases. All arithmetic uses BigInt to avoid the precision loss that affects JavaScript's Number type above 9,007,199,254,740,991 (2^53 − 1). Invalid characters for the selected base (e.g., "2" in binary) show an error immediately.

The Formula

All conversions go through BigInt for exact integer arithmetic. Parsing: BigInt('0b'+bin), BigInt('0o'+oct), BigInt(dec), BigInt('0x'+hex). Output: bigint.toString(base) for each target base.

Frequently Asked Questions

Why does precision matter above 2^53?
JavaScript's Number type is a 64-bit IEEE 754 float with 53 bits of mantissa. Integers above 2^53 − 1 cannot be represented exactly — consecutive integers become indistinguishable. This calculator uses BigInt, which has arbitrary precision.
What is hexadecimal used for?
Hex is ubiquitous in computing for memory addresses, color codes (#FF5733), HTML/CSS colors, byte sequences, and machine-readable values in debuggers. One hex digit maps to exactly 4 binary bits (a nibble).
Can I enter negative numbers?
Yes for decimal (e.g., −5). The magnitude is shown in all bases; for the signed two's-complement representation in a specific bit-width, use the Bitwise Calculator.