Activity 2.3.1 — Hexadecimal and Octal Number Systems
Learning Objectives
By the end of this lesson, students will be able to:
- Explain why hexadecimal and octal number systems are used in digital electronics.
- Count in decimal, binary, octal, and hexadecimal.
- Convert between decimal ↔ octal using Successive Division and Weighted Multiplication.
- Convert between decimal ↔ hexadecimal using Successive Division and Weighted Multiplication.
- Convert directly between binary, octal, and hexadecimal using the grouping shortcut.
Vocabulary
Vocabulary (click to expand)
| Term | Definition |
|---|---|
| Base / Radix | The number of unique symbols a number system uses (e.g., Base 10 = decimal) |
| Octal | Base-8 number system; digits 0–7 |
| Hexadecimal | Base-16 number system; digits 0–9 and A–F |
| LSD | Least Significant Digit — the rightmost digit (lowest place value) |
| MSD | Most Significant Digit — the leftmost digit (highest place value) |
| Data Bus | A group of parallel wires that transfer data within a computer |
| Successive Division | Method for converting decimal → another base by repeated division |
| Weighted Multiplication | Method for converting any base → decimal by multiplying by place values |
| Bit-Weighting Factor | The positional value of a digit (e.g., 2⁰=1, 2¹=2, 8⁰=1, 16¹=16) |
Part 1: Why Do We Need More Number Systems?
The Problem with Binary
Humans think in decimal (base 10). Computers operate in binary (base 2). The mismatch gets worse as data buses get wider.
A value on a 32-bit data bus looks like this in binary:
0110 1001 0111 0001 0011 0100 1100 1010
That’s 32 characters — hard to read, easy to mistype.
The Solution: Compact Notation
| System | Base | Digits | Compact? |
|---|---|---|---|
| Binary | 2 | 0, 1 | ❌ Very long |
| Octal | 8 | 0–7 | ✅ Shorter |
| Hexadecimal | 16 | 0–9, A–F | ✅✅ Most compact |
The same 32-bit value above in hex is just: 697134CA — 8 characters!
Why powers of 2? Binary, octal (2³=8), and hexadecimal (2⁴=16) are all powers of 2, which means they have a clean, direct relationship to binary. This is why they are used in computing.
Number System Relationship
graph LR
DEC["Decimal<br/>Base 10"]
BIN["Binary<br/>Base 2"]
OCT["Octal<br/>Base 8"]
HEX["Hexadecimal<br/>Base 16"]
DEC -- "Successive Division<br/>Weighted Mult." --> BIN
BIN -- "Weighted Mult.<br/>Successive Division" --> DEC
DEC -- "Successive Division<br/>Weighted Mult." --> OCT
OCT -- "Weighted Mult.<br/>Successive Division" --> DEC
DEC -- "Successive Division<br/>Weighted Mult." --> HEX
HEX -- "Weighted Mult.<br/>Successive Division" --> DEC
BIN -- "Group in 3s" --> OCT
OCT -- "Expand to 3s" --> BIN
BIN -- "Group in 4s" --> HEX
HEX -- "Expand to 4s" --> BIN
style DEC fill:#f9f,stroke:#333,stroke-width:2px
style BIN fill:#bbf,stroke:#333,stroke-width:2px
style OCT fill:#bfb,stroke:#333,stroke-width:2px
style HEX fill:#fbf,stroke:#333,stroke-width:2px
Place-Value Comparison
┌─── Binary (Base 2) ───┐
│ 2⁷ 2⁶ 2⁵ 2⁴ 2³ 2² 2¹ 2⁰
│ 128 64 32 16 8 4 2 1
┌─── Octal (Base 8) ────┐
│ 8³ 8² 8¹ 8⁰
│ 512 64 8 1
┌── Hexadecimal (Base 16) ┐
│ 16³ 16² 16¹ 16⁰
│ 4096 256 16 1
┌── Decimal (Base 10) ──┐
│ 10³ 10² 10¹ 10⁰
│ 1000 100 10 1
Part 2: Counting in All Four Systems
The table below shows the numbers 0–20 in all four number systems. Study the patterns — especially where the hexadecimal system uses letters instead of multi-digit numbers.
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 0 | 00000 | 0 | 0 |
| 1 | 00001 | 1 | 1 |
| 2 | 00010 | 2 | 2 |
| 3 | 00011 | 3 | 3 |
| 4 | 00100 | 4 | 4 |
| 5 | 00101 | 5 | 5 |
| 6 | 00110 | 6 | 6 |
| 7 | 00111 | 7 | 7 |
| 8 | 01000 | 10 | 8 |
| 9 | 01001 | 11 | 9 |
| 10 | 01010 | 12 | A |
| 11 | 01011 | 13 | B |
| 12 | 01100 | 14 | C |
| 13 | 01101 | 15 | D |
| 14 | 01110 | 16 | E |
| 15 | 01111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 17 | 10001 | 21 | 11 |
| 18 | 10010 | 22 | 12 |
| 19 | 10011 | 23 | 13 |
| 20 | 10100 | 24 | 14 |
Key insight: In hexadecimal,
Arepresents 10,B= 11,C= 12,D= 13,E= 14, andF= 15. A number system needs unique symbols — “10” is already two symbols, so letters A–F fill the gap.
Subscript notation: Always subscript the base to avoid confusion.
Examples:94₁₀= decimal 94,134₈= octal 134,5E₁₆= hex 5E
An “H” suffix is also acceptable:5EH
Part 3: The Two Conversion Methods (Universal)
These two processes work for any base conversion, not just binary.
Method 1: Successive Division (Decimal → Any Base)
Used to convert FROM decimal TO any other base.
Steps:
- Divide the decimal number by the target base.
- Record the remainder — this becomes the LSD (rightmost digit).
- If the quotient is 0, stop. Otherwise, use the quotient as the new number and repeat from Step 1.
- Read remainders from bottom to top → this is your converted number.
Method 2: Weighted Multiplication (Any Base → Decimal)
Used to convert FROM any base TO decimal.
Steps:
- Assign each digit its bit-weighting factor based on its position:
- Position 0 (rightmost) = Base⁰
- Position 1 = Base¹
- Position 2 = Base²
- And so on…
- Multiply each digit by its bit-weighting factor.
- Sum all the products to get the decimal result.
Part 4: Decimal ↔ Octal Conversion
Decimal → Octal (Successive Division by 8)
Worked Example: Convert 94₁₀ to octal.
94 ÷ 8 = 11 remainder 6 ← LSD
11 ÷ 8 = 1 remainder 3
1 ÷ 8 = 0 remainder 1 ← MSD (stop, quotient = 0)
Read remainders bottom to top: 1, 3, 6
Result: 94₁₀ = 136₈
Remember: Read remainders from BOTTOM (last) to TOP (first) — that’s MSD to LSD order.
Practice Problem — Decimal → Octal
Convert 189₁₀ into its octal equivalent. Work it out before checking the solution below.
Show Solution
189 ÷ 8 = 23 remainder 5 ← LSD
23 ÷ 8 = 2 remainder 7
2 ÷ 8 = 0 remainder 2 ← MSD
Read bottom to top: 2, 7, 5
Result: 189₁₀ = 275₈
Octal → Decimal (Weighted Multiplication by powers of 8)
Bit-weighting factors for octal:
| Position | 3 | 2 | 1 | 0 |
|---|---|---|---|---|
| Factor | 8³=512 | 8²=64 | 8¹=8 | 8⁰=1 |
Worked Example: Convert 136₈ to decimal.
1 × 8² = 1 × 64 = 64
3 × 8¹ = 3 × 8 = 24
6 × 8⁰ = 6 × 1 = 6
------
Sum = 94
Result: 136₈ = 94₁₀ ✓
Practice Problem — Octal → Decimal
Convert 134₈ into its decimal equivalent. Work it out before checking the solution below.
Show Solution
1 × 8² = 1 × 64 = 64
3 × 8¹ = 3 × 8 = 24
4 × 8⁰ = 4 × 1 = 4
------
Sum = 92
Result: 134₈ = 92₁₀
Part 5: Decimal ↔ Hexadecimal Conversion
Decimal → Hexadecimal (Successive Division by 16)
Worked Example: Convert 94₁₀ to hexadecimal.
94 ÷ 16 = 5 remainder 14 → E ← LSD
5 ÷ 16 = 0 remainder 5 ← MSD (stop, quotient = 0)
Read bottom to top: 5, E
Result: 94₁₀ = 5E₁₆ (or 5EH)
Reminder: Remainders 10–15 become letters A–F!
| Remainder | Hex Digit |
|---|---|
| 10 | A |
| 11 | B |
| 12 | C |
| 13 | D |
| 14 | E |
| 15 | F |
Practice Problem — Decimal → Hexadecimal
Convert 429₁₀ into its hexadecimal equivalent. Work it out before checking the solution.
Show Solution
429 ÷ 16 = 26 remainder 13 → D ← LSD
26 ÷ 16 = 1 remainder 10 → A
1 ÷ 16 = 0 remainder 1 ← MSD
Read bottom to top: 1, A, D
Result: 429₁₀ = 1AD₁₆ (or 1ADH)
Hexadecimal → Decimal (Weighted Multiplication by powers of 16)
Bit-weighting factors for hexadecimal:
| Position | 3 | 2 | 1 | 0 |
|---|---|---|---|---|
| Factor | 16³=4096 | 16²=256 | 16¹=16 | 16⁰=1 |
Worked Example: Convert 5E₁₆ to decimal.
5 × 16¹ = 5 × 16 = 80
E × 16⁰ = 14 × 1 = 14
-----
Sum = 94
Result: 5E₁₆ = 94₁₀ ✓
Practice Problem — Hexadecimal → Decimal
Convert B2EH into its decimal equivalent. Work it out before checking the solution.
Show Solution
B = 11, 2 = 2, E = 14
B × 16² = 11 × 256 = 2816
2 × 16¹ = 2 × 16 = 32
E × 16⁰ = 14 × 1 = 14
-------
Sum = 2862
Result: B2EH = 2862₁₀
Part 6: Cross-Base Conversions (Hex ↔ Octal, Octal ↔ Binary)
When converting between non-decimal bases (hex → octal, octal → binary), there is no direct formula. You must use decimal as a stepping stone:
Hex → Decimal → Octal
Octal → Decimal → Binary
Practice Problem — Hexadecimal → Octal
Convert 5AH into its octal equivalent.
Show Solution
Step 1: Hex → Decimal
5 × 16¹ = 5 × 16 = 80
A × 16⁰ = 10 × 1 = 10
----
Sum = 90
5AH = 90₁₀
Step 2: Decimal → Octal
90 ÷ 8 = 11 remainder 2 ← LSD
11 ÷ 8 = 1 remainder 3
1 ÷ 8 = 0 remainder 1 ← MSD
Result: 90₁₀ = 132₈
Final: 5AH = 132₈
Practice Problem — Octal → Binary
Convert 132₈ into its binary equivalent.
Show Solution
Step 1: Octal → Decimal
1 × 8² = 1 × 64 = 64
3 × 8¹ = 3 × 8 = 24
2 × 8⁰ = 2 × 1 = 2
------
Sum = 90
132₈ = 90₁₀
Step 2: Decimal → Binary
90 ÷ 2 = 45 remainder 0 ← LSD
45 ÷ 2 = 22 remainder 1
22 ÷ 2 = 11 remainder 0
11 ÷ 2 = 5 remainder 1
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1 ← MSD
Result: 90₁₀ = 1011010₂
Final: 132₈ = 1011010₂
Part 7: The Binary ↔ Octal ↔ Hex Shortcut ⚡
Since binary, octal, and hexadecimal are all powers of 2, there is a direct shortcut that bypasses decimal entirely.
Bit Grouping Visual
Binary: 0 1 0 1 1 0 1 0 (= 90₁₀)
├─────┤ ├─────┤ ├─────┤
Octal: 1 3 2 ← groups of 3 bits (pad left with 0)
├──────────┤ ├──────────┤
Hex: 5 A ← groups of 4 bits (pad left with 0)
Result: 01011010₂ = 132₈ = 5A₁₆ = 90₁₀
| Conversion | Group Size | Reason |
|---|---|---|
| Binary ↔ Octal | 3 binary bits | 2³ = 8 |
| Binary ↔ Hexadecimal | 4 binary bits | 2⁴ = 16 |
Binary → Octal
- Start from the right, group binary digits into sets of 3.
- Add leading zeros to the leftmost group if needed.
- Convert each group of 3 bits to its octal digit (0–7).
Binary → Hexadecimal
- Start from the right, group binary digits into sets of 4.
- Add leading zeros to the leftmost group if needed.
- Convert each group of 4 bits to its hex digit (0–F).
Worked Example — Shortcut
Binary: 1 0 1 1 0 1 0₂
Octal grouping (sets of 3, right to left):
001 | 011 | 010
1 3 2
Result: 132₈ ✓
Hex grouping (sets of 4, right to left):
0101 | 1010
5 A
Result: 5AH ✓
This shortcut only works between number systems whose bases are powers of 2. It does NOT work for decimal conversions.
Practice Problem — Shortcut Technique
Use the shortcut to convert A6₁₆ into binary and octal. Check with a calculator.
Show Solution
Step 1: Hex → Binary (expand each hex digit to 4 binary bits)
A = 1010
6 = 0110
A6₁₆ = 1010 0110₂
Step 2: Binary → Octal (group binary into sets of 3)
Rearrange: 001 | 010 | 011 | 0 → need 8 bits: 10100110
Group right-to-left: 010 | 100 | 110 → Wait, let's be precise:
10100110₂ → split right to left into groups of 3:
010 | 100 | 110
2 4 6
Result: A6₁₆ = 10100110₂ = 246₈
Calculator check: A6₁₆ = 166₁₀ = 246₈ ✓
Summary: Conversion Road Map
graph TD
DEC["DECIMAL<br/>Base 10"]
BIN["BINARY<br/>Base 2"]
OCT["OCTAL<br/>Base 8"]
HEX["HEXADECIMAL<br/>Base 16"]
DEC -- "Successive Division" --> BIN
DEC -- "Successive Division" --> OCT
DEC -- "Successive Division" --> HEX
BIN -- "Weighted Multiplication" --> DEC
OCT -- "Weighted Multiplication" --> DEC
HEX -- "Weighted Multiplication" --> DEC
BIN <--> |"Group/Expand<br/>in 3s"| OCT
BIN <--> |"Group/Expand<br/>in 4s"| HEX
OCT -. "Go through<br/>Decimal" .-> HEX
HEX -. "Go through<br/>Decimal" .-> OCT
style DEC fill:#f9f,stroke:#333,stroke-width:2px
style BIN fill:#bbf,stroke:#333,stroke-width:2px
style OCT fill:#bfb,stroke:#333,stroke-width:2px
style HEX fill:#fbf,stroke:#333,stroke-width:2px
| Conversion Direction | Method |
|---|---|
| Decimal → Any Base | Successive Division (divide by base, collect remainders bottom→top) |
| Any Base → Decimal | Weighted Multiplication (multiply each digit × base^position, sum all) |
| Binary ↔ Octal | Group binary into 3s |
| Binary ↔ Hex | Group binary into 4s |
| Hex ↔ Octal | Go through decimal (Hex→Dec→Oct or Oct→Dec→Hex) |
Key Reminders for the Activity
- Always subscript your bases to avoid confusion (e.g.,
94₁₀,136₈,5EH). - When using successive division, read remainders bottom to top (LSD → MSD).
- When converting hex → decimal, replace letters with their numeric values first (A=10, B=11, C=12, D=13, E=14, F=15).
- The binary ↔ octal/hex shortcut requires adding leading zeros to fill out groups on the left side.
- Cross-base conversions (like hex → octal) require a decimal step in the middle.
📝 Quick Reference: Hex Digit Values
| Hex | Dec | Binary |
|---|---|---|
| 0 | 0 | 0000 |
| 1 | 1 | 0001 |
| 2 | 2 | 0010 |
| 3 | 3 | 0011 |
| 4 | 4 | 0100 |
| 5 | 5 | 0101 |
| 6 | 6 | 0110 |
| 7 | 7 | 0111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
Derived from PLTW Digital Electronics — Activity 2.3.1 (Copyright 2021, PLTW)