Number Bases Table
A complete conversion reference for the four most common number systems: decimal (base 10), binary (base 2), octal (base 8), and hexadecimal (base 16). Essential for computer science, digital electronics, and low-level programming.
How Number Bases Work
- Decimal (base 10): digits 0–9. The system used in everyday arithmetic.
- Binary (base 2): digits 0 and 1. Used internally by all digital computers.
- Octal (base 8): digits 0–7. Common in Unix file permissions and legacy systems.
- Hexadecimal (base 16): digits 0–9 and A–F. Used in memory addresses, color codes, and bytecode.
0 to 15 — Full Conversion Table
Complete table for the first 16 values (one nibble / half a byte). The hexadecimal digits A–F correspond to decimal 10–15.
| Decimal | Binary (4-bit) | Octal | Hexadecimal |
|---|---|---|---|
| 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 |
Common Byte Values (0–255)
Key 8-bit values in multiples of 16, plus the maximum byte value 255. Binary is shown with a space between the two nibbles for readability.
| Decimal | Binary (8-bit) | Octal | Hexadecimal |
|---|---|---|---|
| 0 | 0000 0000 | 000 | 00 |
| 16 | 0001 0000 | 020 | 10 |
| 32 | 0010 0000 | 040 | 20 |
| 48 | 0011 0000 | 060 | 30 |
| 64 | 0100 0000 | 100 | 40 |
| 80 | 0101 0000 | 120 | 50 |
| 96 | 0110 0000 | 140 | 60 |
| 112 | 0111 0000 | 160 | 70 |
| 128 | 1000 0000 | 200 | 80 |
| 144 | 1001 0000 | 220 | 90 |
| 160 | 1010 0000 | 240 | A0 |
| 176 | 1011 0000 | 260 | B0 |
| 192 | 1100 0000 | 300 | C0 |
| 208 | 1101 0000 | 320 | D0 |
| 224 | 1110 0000 | 340 | E0 |
| 240 | 1111 0000 | 360 | F0 |
| 255 | 1111 1111 | 377 | FF |
Powers of 2
Powers of 2 are fundamental in binary and hex — each power of 2 is a 1 followed by zeros in binary, and maps cleanly to hexadecimal boundaries.
| n | 2ⁿ (Decimal) | Hexadecimal | Notes |
|---|---|---|---|
| 0 | 1 | 0x1 | |
| 1 | 2 | 0x2 | |
| 2 | 4 | 0x4 | |
| 3 | 8 | 0x8 | |
| 4 | 16 | 0x10 | |
| 5 | 32 | 0x20 | |
| 6 | 64 | 0x40 | |
| 7 | 128 | 0x80 | |
| 8 | 256 | 0x100 | 1 byte + 1 |
| 9 | 512 | 0x200 | |
| 10 | 1,024 | 0x400 | 1 KiB |
| 11 | 2,048 | 0x800 | |
| 12 | 4,096 | 0x1000 | |
| 13 | 8,192 | 0x2000 | |
| 14 | 16,384 | 0x4000 | |
| 15 | 32,768 | 0x8000 | |
| 16 | 65,536 | 0x10000 | 1 segment (x86) |
| 20 | 1,048,576 | 0x100000 | 1 MiB |
| 24 | 16,777,216 | 0x1000000 | 16 MiB |
| 30 | 1,073,741,824 | 0x40000000 | 1 GiB |
| 31 | 2,147,483,648 | 0x80000000 | Absolute value of min signed 32-bit int (INT_MIN) |
| 32 | 4,294,967,296 | 0x100000000 | Max unsigned 32-bit int + 1 (UINT_MAX + 1) |
Conversion Tips
- Decimal → Binary: divide repeatedly by 2 and read remainders bottom-up.
- Binary → Hex: group bits into nibbles of 4 from the right, then convert each nibble using the 0–15 table above.
- Hex → Binary: expand each hex digit to its 4-bit binary equivalent.
- Octal ↔ Binary: same as hex but with 3-bit groups instead of 4.
- Prefix conventions: binary:
0b1010; octal:0o12or012; hex:0xFF.