Number bases explained
Computers store everything as binary — sequences of 0s and 1s. But working with long binary strings is tedious, so programmers also use octal (base-8) and hexadecimal (base-16) as more compact representations of the same values. This tool lets you convert between all four bases instantly.
| Base | Digits used | Common use |
|---|---|---|
| Decimal (10) | 0–9 | Everyday numbers |
| Binary (2) | 0, 1 | CPU / memory / logic |
| Octal (8) | 0–7 | Unix file permissions |
| Hexadecimal (16) | 0–9, A–F | Colors, memory addresses, byte values |
Common values across bases
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 42 | 101010 | 52 | 2A |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 1024 | 10000000000 | 2000 | 400 |
| 65535 | 1111111111111111 | 177777 | FFFF |
How to convert decimal to binary manually
Divide the number by 2 repeatedly and record the remainders. Read the remainders bottom to top for the binary result.
Convert 42 to binary:
42 ÷ 2 = 21 remainder 0
21 ÷ 2 = 10 remainder 1
10 ÷ 2 = 5 remainder 0
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1
Read bottom to top: 101010
Why hex and octal group neatly with binary
One hex digit maps exactly to 4 binary bits. One octal digit maps exactly to 3 binary bits. This makes conversion between these bases trivial — no math required, just group the bits.
Binary: 1010 1111
Hex: A F → AF
Binary: 001 010 111
Octal: 1 2 7 → 127