Number Systems Cheat Sheet
Quick reference for common number systems used in computing and mathematics.
Overview
| System | Base | Digits | Common Use |
|---|---|---|---|
| Binary | 2 | 0, 1 | Low-level computing, hardware |
| Octal | 8 | 0–7 | Unix permissions, legacy systems |
| Decimal | 10 | 0–9 | Human-readable numbers |
| Hexadecimal | 16 | 0–9, A–F | Memory, colors, debugging |
Binary (Base 2)
- Digits:
0,1 - Each position represents a power of 2
1011₂ = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 11₁₀
Common prefixes:
- 0b1010 (programming)
Octal (Base 8)
- Digits:
0–7 - Each position represents a power of 8
17₈ = 1×8¹ + 7×8⁰ = 15₁₀
Common prefixes:
- 0755 (Unix file permissions)
Decimal (Base 10)
- Digits:
0–9 - Standard number system for humans
345₁₀ = 3×10² + 4×10¹ + 5×10⁰
Hexadecimal (Base 16)
- Digits:
0–9,A–F - Each position represents a power of 16
2F₁₆ = 2×16¹ + 15×16⁰ = 47₁₀
Common prefixes:
- 0xFF
Base Conversion Summary
| From \ To | Binary | Octal | Decimal | Hex |
|---|---|---|---|---|
| Binary | — | Group by 3 | Sum powers of 2 | Group by 4 |
| Octal | Convert to binary | — | Sum powers of 8 | Binary → Hex |
| Decimal | Divide by 2 | Divide by 8 | — | Divide by 16 |
| Hex | Convert to binary | Binary → Octal | Sum powers of 16 | — |
Binary ↔ Hex Mapping
| Binary | Hex |
|---|---|
| 0000 | 0 |
| 0001 | 1 |
| 0010 | 2 |
| 0011 | 3 |
| 0100 | 4 |
| 0101 | 5 |
| 0110 | 6 |
| 0111 | 7 |
| 1000 | 8 |
| 1001 | 9 |
| 1010 | A |
| 1011 | B |
| 1100 | C |
| 1101 | D |
| 1110 | E |
| 1111 | F |
Common Ranges
| Bits | Unsigned Range | Signed (Two's Complement) |
|---|---|---|
| 4 | 0 – 15 | −8 – 7 |
| 8 | 0 – 255 | −128 – 127 |
| 16 | 0 – 65,535 | −32,768 – 32,767 |
| 32 | 0 – 4,294,967,295 | −2,147,483,648 – 2,147,483,647 |
Practical Examples
255₁₀ = 11111111₂ = FF₁₆
64₁₀ = 1000000₂ = 100₈
- Binary → hardware & bitwise ops
- Octal → permissions (
rwx) - Hex → memory addresses, colors (
#FFAA00)