Base Converter guide
Binary, Decimal, Octal and Hex Conversion Chart
The first sixteen values run 0 to 15 in decimal, 0000 to 1111 in binary, 0 to 17 in octal, and 0 to F in hexadecimal. Those sixteen rows cover one hex digit and four binary digits, which is the pattern everything else is built from.
The first sixteen values
This is the table worth knowing by heart. Everything larger is built out of these.
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
Powers of two
These are the place values in binary, and the reason computing numbers look the way they do.
| Power | Value | Power | Value |
|---|---|---|---|
| 2⁰ | 1 | 2⁸ | 256 |
| 2¹ | 2 | 2⁹ | 512 |
| 2² | 4 | 2¹⁰ | 1024 |
| 2³ | 8 | 2¹¹ | 2048 |
| 2⁴ | 16 | 2¹² | 4096 |
| 2⁵ | 32 | 2¹⁶ | 65536 |
| 2⁶ | 64 | 2²⁰ | 1048576 |
| 2⁷ | 128 | 2³² | 4294967296 |
Byte boundaries worth recognising
| Decimal | Hex | Binary | What it is |
|---|---|---|---|
| 15 | F | 1111 | One hex digit, four bits |
| 16 | 10 | 10000 | Hex rolls over |
| 127 | 7F | 1111111 | Largest signed byte |
| 128 | 80 | 10000000 | Top bit set |
| 255 | FF | 11111111 | Largest unsigned byte |
| 256 | 100 | 100000000 | Needs a second byte |
| 65535 | FFFF | 16 ones | Largest 16-bit value |
Numbers you will keep meeting
255 turns up everywhere because it is the largest value in one byte. Colour channels run 0 to 255. Network masks use it. If you see 255, a byte is involved.
1024 is 2¹⁰, which is why a kilobyte is 1024 bytes rather than 1000. The same logic gives 1024 KB to a megabyte.
65535 is the largest 16-bit value, which is why there are 65535 usable network ports and why older games so often capped scores or item counts at that number.
4294967295 is the largest 32-bit value — around 4.3 billion. It is the reason 32-bit systems could not address more than 4GB of memory.
Reading the chart four bits at a time
Each hexadecimal digit stands for exactly four binary digits, which is why programmers use hex as shorthand for binary. To convert 10110011, split it into 1011 and 0011. 1011 is 11, written B, and 0011 is 3, so the number is B3 in hex. In decimal that is 11 × 16 + 3 = 179.
Patterns that make the chart easier to remember
- All ones is one less than a power of two. 1111 is 15, and 11111111 is 255, which is 2⁸ − 1.
- A single 1 followed by zeros is a power of two. 1000 is 8, 10000 is 16 and 100000000 is 256.
- Hex F is always 1111. The top of the hex digit range is the top of four bits.
Checking a chart you copied
Pick any row and convert it back. Decimal 10 is 1010 in binary and A in hex. 8 + 2 = 10 confirms the binary, and A being the tenth digit after 0 to 9 confirms the hex. One checked row in each part of the table is enough to catch a column that has slipped.