Binary, Hex and Decimal Chart
Look up small numbers in the four number systems programmers use most. For any other value, use the number base converter.
0 to 32
Decimal, binary, octal and hexadecimal equivalents| 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 |
|---|
| 16 | 0001 0000 | 20 | 10 |
|---|
| 17 | 0001 0001 | 21 | 11 |
|---|
| 18 | 0001 0010 | 22 | 12 |
|---|
| 19 | 0001 0011 | 23 | 13 |
|---|
| 20 | 0001 0100 | 24 | 14 |
|---|
| 21 | 0001 0101 | 25 | 15 |
|---|
| 22 | 0001 0110 | 26 | 16 |
|---|
| 23 | 0001 0111 | 27 | 17 |
|---|
| 24 | 0001 1000 | 30 | 18 |
|---|
| 25 | 0001 1001 | 31 | 19 |
|---|
| 26 | 0001 1010 | 32 | 1A |
|---|
| 27 | 0001 1011 | 33 | 1B |
|---|
| 28 | 0001 1100 | 34 | 1C |
|---|
| 29 | 0001 1101 | 35 | 1D |
|---|
| 30 | 0001 1110 | 36 | 1E |
|---|
| 31 | 0001 1111 | 37 | 1F |
|---|
| 32 | 0010 0000 | 40 | 20 |
|---|
Useful byte values
| Decimal | Binary | Hex | Why it matters |
|---|
| 64 | 0100 0000 | 40 | Bit 6 set |
|---|
| 100 | 0110 0100 | 64 | A round decimal number |
|---|
| 127 | 0111 1111 | 7F | Largest signed 8-bit value |
|---|
| 128 | 1000 0000 | 80 | Top bit of a byte |
|---|
| 192 | 1100 0000 | C0 | Common first byte of private IPv4 addresses (192.168.x.x) |
|---|
| 240 | 1111 0000 | F0 | High nibble all ones |
|---|
| 255 | 1111 1111 | FF | Largest byte value; full-intensity color channel (#FF) |
|---|
Powers of two
| Power | Decimal | Hex | Common name |
|---|
| 2⁴ | 16 | 10 | nibble values (16) |
|---|
| 2⁸ | 256 | 100 | values in a byte (256) |
|---|
| 2¹⁰ | 1,024 | 400 | 1 KiB |
|---|
| 2¹⁶ | 65,536 | 10000 | values in 16 bits (65,536) |
|---|
| 2²⁰ | 1,048,576 | 100000 | 1 MiB |
|---|
| 2³⁰ | 1,073,741,824 | 40000000 | 1 GiB |
|---|
| 2³² | 4,294,967,296 | 100000000 | values in 32 bits (≈ 4.29 billion) |
|---|
Reading hex colors
Web colors like #1E90FF are three bytes in hex: red 1E (30), green 90 (144), blue FF (255). Each pair runs from 00 to FF, i.e. 0 to 255.