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:
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.
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
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.
Practice Problem — Octal → Decimal¶
Convert 134₈ into its decimal equivalent. Work it out before checking the solution below.
Show Solution
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
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.
Practice Problem — Hexadecimal → Decimal¶
Convert B2EH into its decimal equivalent. Work it out before checking the solution.
Show Solution
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:
Practice Problem — Hexadecimal → Octal¶
Convert 5AH into its octal equivalent.
Show Solution
Step 1: Hex → Decimal
Step 2: Decimal → Octal
Practice Problem — Octal → Binary¶
Convert 132₈ into its binary equivalent.
Show Solution
Step 1: Octal → Decimal
Step 2: Decimal → Binary
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.
| 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)
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¶
┌─────────────────────┐
│ DECIMAL (10) │
└──────┬──────────────┘
Succ. Div ↑↓ Weighted Mult
┌───────────────┼───────────────┐
▼ ▼ ▼
BINARY (2) OCTAL (8) HEX (16)
│ │ │
└───────────────┴───────────────┘
↕ Direct shortcut (grouping)
(only works between powers of 2)
| 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)