COA Notes
Binary, octal, decimal, and hexadecimal number systems with conversion methods and examples.
Introduction
Everything inside a computer is represented as numbers — and not just the decimal numbers you're used to. Computers work with binary (base-2) because their circuits have two states: on and off, high voltage and low voltage, 1 and 0. But binary numbers get long and hard to read, so computer scientists also use octal (base-8) and hexadecimal (base-16) as convenient shorthand. Mastering these number systems and converting between them is the foundation of everything in computer organization.
The Concept of a Base (Radix)
Every number system has a base (also called radix) — the number of unique digits it uses.
| System | Base | Digits Used | Example |
|---|---|---|---|
| Binary | 2 | 0, 1 | 1010₂ |
| Octal | 8 | 0-7 | 12₈ |
| Decimal | 10 | 0-9 | 10₁₀ |
| Hexadecimal | 16 | 0-9, A-F | A₁₆ |
In any base-r system, the value of a number is calculated using positional notation:
d₃ × r³ + d₂ × r² + d₁ × r¹ + d₀ × r⁰
Where d is each digit and r is the radix.
Binary Number System (Base-2)
Why Binary?
Electronic circuits are naturally bistable — they rest in one of two states. This maps perfectly to binary: 0 = low voltage (typically 0V), 1 = high voltage (typically 3.3V or 5V). Building circuits that reliably distinguish between two states is much easier than distinguishing between ten states.
Counting in Binary
Positional Values
Each bit position represents a power of 2:
Example: 10110₂ = 1×16 + 0×8 + 1×4 + 1×2 + 0×1 = 22₁₀
Binary Terminology
- Bit: A single binary digit (0 or 1)
- Nibble: 4 bits (e.g., 1010)
- Byte: 8 bits (e.g., 10110011)
- Word: Processor-dependent (16, 32, or 64 bits)
Octal Number System (Base-8)
Why Octal?
Octal provides a compact representation of binary. Since 8 = 2³, each octal digit represents exactly 3 binary digits. This was especially popular in older systems with 12-bit, 24-bit, or 36-bit words (all multiples of 3).
Converting Binary to Octal
Group binary digits into sets of 3 (from right to left), then convert each group:
| Binary | 1 011 101 110 |
| Octal | 1 3 5 6 |
| Result | 1011101110₂ = 1356₈ |
Converting Octal to Binary
Replace each octal digit with its 3-bit binary equivalent:
| Octal | 4 7 2 |
| Binary | 100 111 010 |
| Result | 472₈ = 100111010₂ |
Hexadecimal Number System (Base-16)
Why Hexadecimal?
Hexadecimal is the most popular shorthand for binary in modern computing. Since 16 = 2⁴, each hex digit represents exactly 4 binary digits (one nibble). This makes it perfect for byte-oriented architectures — one byte is always exactly 2 hex digits.
Hex Digits
| Decimal | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
| Hex | 0 1 2 3 4 5 6 7 8 9 A B C D E F |
| Binary | 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 |
Converting Binary to Hexadecimal
Group binary digits into sets of 4 (from right to left):
| Binary | 1010 1111 0011 |
| Hex | A F 3 |
| Result | 101011110011₂ = AF3₁₆ |
Where You'll See Hex
- Memory addresses: 0x7FFE0000
- Color codes: #FF5733 (RGB colors)
- MAC addresses: 00:1A:2B:3C:4D:5E
- Machine code: 8B 45 FC
Conversion Methods
Decimal to Binary (Repeated Division)
Divide by 2 repeatedly, collect remainders from bottom to top:
25 ÷ 2 = 12 remainder 1 ↑
12 ÷ 2 = 6 remainder 0 │
6 ÷ 2 = 3 remainder 0 │ Read upward: 11001
3 ÷ 2 = 1 remainder 1 │
1 ÷ 2 = 0 remainder 1 │
So 25₁₀ = 11001₂
Decimal to Any Base (Repeated Division by Base)
Same method works for any base. For 25 to octal:
25 ÷ 8 = 3 remainder 1 ↑
3 ÷ 8 = 0 remainder 3 │ Read upward: 31
So 25₁₀ = 31₈
Fractional Conversion (Repeated Multiplication)
For decimal fractions, multiply by the target base and collect integer parts:
| 0.625 × 2 = 1.25 | 1 |
| 0.25 × 2 = 0.5 | 0 |
| 0.5 × 2 = 1.0 | 1 |
So 0.625₁₀ = 0.101₂
Any Base to Decimal (Positional Expansion)
Multiply each digit by its positional value:
Practical Applications
Memory Addresses
A 32-bit memory address like 11111111111111100000000000000000 is unreadable. In hex: FFFE0000 — much cleaner.
Debugging
When examining memory contents or machine code, hexadecimal makes patterns visible that would be invisible in binary.
Color Representation
Web colors use hex: #FF0000 = Red (255,0,0), #00FF00 = Green (0,255,0)
Common Conversions Reference
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 5 | 0101 | 5 | 5 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 100 | 1100100 | 144 | 64 |
| 255 | 11111111 | 377 | FF |
Key Takeaways
- Computers use binary because circuits naturally have two states
- Hexadecimal is the preferred shorthand (1 hex digit = 4 bits = 1 nibble)
- Octal groups binary into sets of 3; hex groups into sets of 4
- Decimal-to-binary conversion uses repeated division by 2
- Fractional conversion uses repeated multiplication by the target base
- Mastering these conversions is essential — they appear everywhere in computer science
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Number Systems Review.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Computer Organization & Architecture topic.
Search Terms
computer-organization, computer organization & architecture, computer, organization, data, representation, number, systems
Related Computer Organization & Architecture Topics