Computer Number Systems

Computers do not use the same numbers you write every day. Inside every computer, all data — text, images, sound, videos — is represented using a system of only two digits: 0 and 1. Understanding number systems is the key to understanding how computers store and process information at the most fundamental level.

What is a Number System?

A number system is a way of representing quantities using a fixed set of symbols and rules. The system you use every day — the one with digits 0 through 9 — is the decimal system. Computers primarily use three systems: binary, octal, and hexadecimal.

Number System │ Base │ Digits Used
──────────────┼──────┼──────────────────────────────
Decimal       │  10  │ 0 1 2 3 4 5 6 7 8 9
Binary        │   2  │ 0 1
Octal         │   8  │ 0 1 2 3 4 5 6 7
Hexadecimal   │  16  │ 0 1 2 3 4 5 6 7 8 9 A B C D E F

The Decimal System (Base 10)

You already know this one. The decimal system uses 10 digits (0–9). The position of each digit determines its value, multiplied by a power of 10.

Example: 3 4 7
         │ │ └── 7 × 10⁰ = 7 × 1   =   7
         │ └──── 4 × 10¹ = 4 × 10  =  40
         └────── 3 × 10² = 3 × 100 = 300
                                      ─────
                            Total =  347

The Binary System (Base 2)

Binary uses only two digits: 0 and 1. These correspond to electrical states — off (0) and on (1). The position of each digit represents a power of 2.

Example: Binary 1 0 1 1
                │ │ │ └── 1 × 2⁰ = 1 × 1  =  1
                │ │ └──── 1 × 2¹ = 1 × 2  =  2
                │ └────── 0 × 2² = 0 × 4  =  0
                └──────── 1 × 2³ = 1 × 8  =  8
                                            ───
                          Decimal Total  =  11

So binary 1011 equals decimal 11.

Converting Decimal to Binary

Divide the number by 2 repeatedly and record the remainders. Read the remainders from bottom to top.

Convert decimal 13 to binary:

13 ÷ 2 = 6 remainder 1  ←── (read last)
 6 ÷ 2 = 3 remainder 0
 3 ÷ 2 = 1 remainder 1
 1 ÷ 2 = 0 remainder 1  ←── (read first)

Read remainders bottom to top: 1 1 0 1

Decimal 13 = Binary 1101

Verify: 1×8 + 1×4 + 0×2 + 1×1 = 8 + 4 + 0 + 1 = 13 ✓

Decimal to Binary Quick Reference

Decimal │ Binary
────────┼────────
0       │ 0000
1       │ 0001
2       │ 0010
3       │ 0011
4       │ 0100
5       │ 0101
6       │ 0110
7       │ 0111
8       │ 1000
9       │ 1001
10      │ 1010
15      │ 1111
16      │ 10000

The Octal System (Base 8)

Octal uses 8 digits (0–7). It groups binary digits in sets of three, making it a shorthand for binary in some computer contexts. Each octal digit represents exactly three binary digits (bits).

Binary:  1 1 0 1 0 1
Group:   ──┬── ──┬──
            6     5   ← Octal: 65

Verify octal 65: 6×8 + 5×1 = 48 + 5 = 53 decimal
Binary 110101 = 32 + 16 + 0 + 4 + 0 + 1 = 53 decimal ✓

Octal is less common today but appears in Unix/Linux file permission settings (for example, chmod 755 sets specific read/write/execute permissions).

The Hexadecimal System (Base 16)

Hexadecimal (or "hex") uses 16 symbols: digits 0–9 and letters A–F. A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.

Hex is the most practically useful shorthand for binary in computing. Each hex digit represents exactly four binary digits (a nibble).

Binary: 1010 1111
         ↓    ↓
Hex:     A    F   → Hex value: AF

Verify: A×16 + F×1 = 10×16 + 15×1 = 160 + 15 = 175 decimal
Binary 10101111 = 128+32+8+4+2+1 = 175 decimal ✓

Hexadecimal in Real Life

Hex appears everywhere in computing:

  • Colour codes in web design: #FF5733 means Red=FF(255), Green=57(87), Blue=33(51).
  • Memory addresses: Programs refer to memory locations like 0x7FFF2A40.
  • Error codes: Windows Blue Screen error codes like 0x000000D1.
  • MAC addresses: Network adapters have addresses like A4:C3:F0:85:AC:12.

Number System Conversion Summary

Decimal │ Binary    │ Octal │ Hexadecimal
────────┼───────────┼───────┼────────────
0       │ 0000      │ 0     │ 0
5       │ 0101      │ 5     │ 5
8       │ 1000      │ 10    │ 8
10      │ 1010      │ 12    │ A
15      │ 1111      │ 17    │ F
16      │ 0001 0000 │ 20    │ 10
255     │ 1111 1111 │ 377   │ FF

Why Computers Use Binary

Engineers could theoretically build computers that use 10 voltage levels to represent decimal digits 0–9. The problem is reliability. Tiny fluctuations in voltage could make a 3 look like a 4 or a 7. Using only two states — low voltage (0) and high voltage (1) — makes the system extremely reliable. The gap between "on" and "off" is large enough that noise and interference almost never cause errors.

Binary simplicity also makes the logic gates inside transistors straightforward. Every computer chip contains billions of transistors, each acting as a binary switch. Binary is the only number system that naturally matches this on/off reality of electronics.

Arithmetic in Binary

Binary Addition Rules:
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10  (write 0, carry 1)

Example: Add binary 0101 (5) + 0011 (3)

  0101
+ 0011
──────
  1000  = 8 in decimal ✓

Binary arithmetic forms the foundation of all arithmetic inside the CPU's ALU. Whether adding prices in a shopping cart or computing coordinates in a 3D game, the CPU performs binary addition billions of times per second.

Leave a Comment

Your email address will not be published. Required fields are marked *