Octal Number System

Understanding Base 8 - The Compact Binary Representation

What is Octal?
Definition
Octal = base 8 number system
Digits: 0, 1, 2, 3, 4, 5, 6, 7
Each position represents a power of 8.
Used in older computer systems and programming because it's a short form of binary (1 octal digit = 3 binary bits).
Example
(157)₈ = (1 × 8²) + (5 × 8¹) + (7 × 8⁰)
= 64 + 40 + 7 = 111 in decimal
Relation with Binary
1 octal digit = 3 binary bits
Easy conversion: just group binary digits into 3's.
0
=
0
0
0
1
=
0
0
1
2
=
0
1
0
3
=
0
1
1
4
=
1
0
0
5
=
1
0
1
6
=
1
1
0
7
=
1
1
1
Example 1: Binary to Octal
(101101)₂ → group as (101)(101) → (5)(5) = 55₈
Example 2: Octal to Binary
(764)₈ → each digit to 3-bit binary:
7 = 111, 6 = 110, 4 = 100 → 111110100₂
Conversions
Decimal → Octal
Method: Division by 8
1
125 ÷ 8 = 15 remainder 5
2
15 ÷ 8 = 1 remainder 7
3
1 ÷ 8 = 0 remainder 1
Reading remainders bottom → top: 175₈
So, 125₁₀ = 175₈
Octal → Decimal
Method: Multiplication by powers of 8
Convert (326)₈ to decimal:
(3 × 8²) + (2 × 8¹) + (6 × 8⁰)
= (3 × 64) + (2 × 8) + (6 × 1)
= 192 + 16 + 6 = 214₁₀
Binary → Octal
Method: Grouping into 3 bits
Convert (1101011)₂ to octal:
Group into 3's: 1 101 011 → add leading 0: 001 101 011
= (1)(5)(3) = 153₈
Octal → Binary
Method: Convert each digit to 3-bit binary
Convert (745)₈ to binary:
7 = 111, 4 = 100, 5 = 101
= 111100101₂
Octal Fractions
Fractions convert by multiplying/dividing by 8.
Convert (0.52)₈ to decimal:
= (5 × 8⁻¹) + (2 × 8⁻²)
= (5 ÷ 8) + (2 ÷ 64)
= 0.625 + 0.03125 = 0.65625₁₀
Octal Arithmetic
Addition
Add like decimal, but carry when ≥ 8.
Example: (345)₈ + (127)₈
= 229₁₀ + 87₁₀ = 316₁₀ = 474₈
345
+ 127
-------
474
1
Rightmost digits: 5 + 7 = 12₁₀ = 14₈ (write 4, carry 1)
2
Next digits: 4 + 2 + carry 1 = 7 (write 7, carry 0)
3
Leftmost digits: 3 + 1 = 4 (write 4)
Result: (345)₈ + (127)₈ = 474₈
Subtraction
Subtract like decimal, borrow when needed.
Example: (542)₈ − (237)₈
= 354₁₀ − 159₁₀ = 195₁₀ = 303₈
542
- 237
-------
303
1
Rightmost digits: 2 − 7 → borrow → 12 − 7 = 5
2
Next digits: 3 (after borrow) − 3 = 0
3
Leftmost digits: 5 − 2 = 3
Result: (542)₈ − (237)₈ = 303₈
Multiplication
Multiply digits, carry when ≥ 8.
Example: (7)₈ × (6)₈
7 × 6 = 42₁₀
Convert 42₁₀ to octal:
42 ÷ 8 = 5 remainder 2
5 ÷ 8 = 0 remainder 5
Result: (7)₈ × (6)₈ = 52₈
Division
Divide normally, convert remainder to octal.
Example: (345)₈ ÷ (5)₈
= 229₁₀ ÷ 5₁₀ = 45₁₀ = 55₈
Convert 45₁₀ to octal:
45 ÷ 8 = 5 remainder 5
5 ÷ 8 = 0 remainder 5
Result: (345)₈ ÷ (5)₈ = 55₈
Uses of Octal
Early Computers
Because binary was long, octal was a compact representation
Digital Electronics
Easier to read than long binary strings
Unix Permissions
File permissions (e.g., 755, 644) are written in octal
Example: Unix file permission 755
Owner:
7 = 111₂ (read, write, execute)
1
1
1
Group:
5 = 101₂ (read, execute)
1
0
1
Others:
5 = 101₂ (read, execute)
1
0
1
Summary
Octal = base 8 (digits 0–7). It provides a compact representation of binary data.
Octal = base 8 (0–7)
1 octal digit = 3 binary digits
Conversions: decimal ↔ octal ↔ binary
Arithmetic rules like decimal, but base 8
Still used in Unix systems and digital circuits