Number Systems in Computing
Computers fundamentally work with binary, but we use different number bases for different purposes.
Why Different Bases?
| Base | Name | Digits | Use Case |
|---|
| 2 | Binary | 0-1 | How computers actually work |
|---|
| 8 | Octal | 0-7 | Unix file permissions |
|---|
| 10 | Decimal | 0-9 | Human-readable numbers |
|---|
| 16 | Hexadecimal | 0-F | Memory addresses, colors |
|---|
Binary (Base 2)
The foundation of all computing. Each digit is a "bit".
Decimal 13 in binary:
13 = 8 + 4 + 0 + 1
= 1×2³ + 1×2² + 0×2¹ + 1×2⁰
= 1101₂
Hexadecimal (Base 16)
Each hex digit = 4 binary bits.
Binary: 1101 0101
Hexadecimal: D 5
Common uses:
- Colors: #FF5733
- Memory: 0x7FFE0000
- MAC addresses: AA:BB:CC:DD:EE:FF
Octal (Base 8)
Each octal digit = 3 binary bits. Used in Unix permissions.
chmod 755 file
7 = rwx (owner)
5 = r-x (group)
5 = r-x (others)