Number Base Converter

Convert numbers between binary, octal, decimal, hex and any base

Convert whole numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36 - all at once, for one number or a whole list. Handles huge numbers exactly, reads 0x/0b/0o prefixes, and shows negative numbers in two's complement.
Try an example:

Output will appear here...

About Number Base Converter

How it works

  1. Each digit is multiplied by a power of the base and added up: in base 16, "FF" = 15 × 16 + 15 = 255. The tool does this with arbitrary-precision (BigInt) arithmetic, so even 100-digit numbers convert exactly.
  2. The number is then written in every other base by repeatedly dividing by the base and keeping the remainders - the table shows decimal, binary, octal and hex side by side.
  3. With "Detect", prefixes choose the base: 0x for hex, 0b for binary, 0o for octal; anything else is read as decimal. Spaces, underscores and thousands commas are ignored.
  4. For negative numbers you can choose a fixed bit width to see the two's complement pattern computers actually store - for example -1 in 8 bits is 1111 1111 (FF).

What you need

  • One or more whole numbers, one per line. Letters are allowed as digits in bases above 10 (A = 10 ... Z = 35).

Tips

  • Each hex digit is exactly 4 binary digits, so hex is a compact way to write binary: 1101 0110 = D6.
  • "Fits in" tells you the smallest integer type (8, 16, 32 or 64-bit) that can hold the number - useful when choosing a data type.
  • Use base 36 for short IDs: it uses all digits and letters, so 1,234,567 becomes QGLJ.
  • Paste a column of numbers to convert them all at once and copy the table.

Limitations

  • Whole numbers only - fractions such as 0.5 or 1.1 (binary) are not supported.
  • Up to 1,000 numbers at a time.

Runs in your browser. Everything happens in your browser - the text you enter is never uploaded.

Frequently asked questions

How do I convert binary to decimal?+

Multiply each bit by its place value (1, 2, 4, 8, 16... from the right) and add them up: 1011 = 8 + 0 + 2 + 1 = 11. Or paste the binary number here (add 0b, or choose Binary as the input base) and read the Decimal column.

How do I convert decimal to hex?+

Divide by 16 repeatedly and write the remainders from last to first, using A-F for 10-15: 255 ÷ 16 = 15 remainder 15, so 255 = FF. This tool does it instantly for any size of number.

What is two's complement?+

The way computers store negative integers: invert all bits of the positive number and add 1. In 8 bits, -1 is 11111111 and -128 is 10000000. It lets the same circuits add positive and negative numbers.

Why is hexadecimal used in programming?+

Because one hex digit maps to exactly four bits, hex is a short, readable way to write binary data - colours (#FF8800), memory addresses, byte values and hashes all use it.

What is the largest base supported?+

Base 36, which uses the digits 0-9 and the letters A-Z.