How to use
- Type a whole number, such as 255, 1010 or FF. A minus sign, spaces and 0x / 0b prefixes are fine.
- Choose the base it is written in (from) and the base you want (to).
- Read the answer, plus binary, octal, decimal and hex all at once. Open Show the working for every step.
How base conversion works
To decimal: place values. Each digit is multiplied by a power of the base, counting from 0 on the right, and the results are added:
1011 in binary = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11
From decimal: repeated division. Divide by the new base, write down the remainder, and repeat with the quotient until it reaches 0. The remainders, read from the last to the first, are the new digits.
Hex and binary shortcut: each hex digit is exactly 4 binary digits, because 16 = 2⁴. So 9C is 1001 1100.
Examples
156 to binary, dividing by 2:
| Division | Quotient | Remainder |
|---|---|---|
| 156 ÷ 2 | 78 | 0 |
| 78 ÷ 2 | 39 | 0 |
| 39 ÷ 2 | 19 | 1 |
| 19 ÷ 2 | 9 | 1 |
| 9 ÷ 2 | 4 | 1 |
| 4 ÷ 2 | 2 | 0 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Reading the remainders from the bottom up gives 10011100.
9C (hex) to decimal: 9×16¹ + C×16⁰ = 144 + 12 = 156, because C is 12.
Common values
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 100 | 1100100 | 144 | 64 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 1,000 | 1111101000 | 1750 | 3E8 |
| 1,024 | 10000000000 | 2000 | 400 |
| 65,535 | 1111111111111111 | 177777 | FFFF |
Large and negative numbers
- Any size, exactly: ordinary JavaScript numbers can’t hold every whole number above 9,007,199,254,740,991 (2⁵³ − 1). This converter uses exact whole-number arithmetic (BigInt), so 2⁶⁴ − 1 is exactly FFFFFFFFFFFFFFFF.
- Negatives keep a minus sign, like −1010. Computers often store them as two’s complement, which depends on the bit width, so it is not shown here.
- Bases up to 36 use the letters A to Z for the digits 10 to 35.
Comparing two values, such as a file size before and after compression? The percentage calculator gives the percentage change.