Octal: Reading & Conversion
Octal: Reading & Conversion
This page introduces the octal numeral system, explains how it relates to binary, and shows how to convert between octal, decimal, and binary.
Introduction
Octal uses base 8. Digits are 0–7. The number written as 10₈ means 8 in decimal.
Octal was more common in early computers, especially before hexadecimal became dominant. It is still useful for compactly representing binary numbers grouped in 3 bits.
Positional values in octal
Each column has a value 8 times the column to its right. This corresponds to powers of 8.
From right to left:
- 8⁰ = 1
- 8¹ = 8
- 8² = 64
- 8³ = 512
- 8⁴ = 4096
- 8⁵ = 32 768
- 8⁶ = 262 144
- 8⁷ = 2 097 152
Example: 76225₈ = 7 × 8⁴ + 6 × 8³ + 2 × 8² + 2 × 8¹ + 5 × 8⁰ = 7 × 4096 + 6 × 512 + 2 × 64 + 2 × 8 + 5 × 1 = 28 672 + 3072 + 128 + 16 + 5 = 31 893₁₀.
From decimal to octal
Method: Division by 8 1. Divide the decimal number by 8. 2. Record the remainder. 3. Repeat with the quotient until 0. 4. Read the remainders backwards.
Example: Convert 83₁₀ to octal 83 ÷ 8 = 10 remainder 3 10 ÷ 8 = 1 remainder 2 1 ÷ 8 = 0 remainder 1 Result: 123₈.
Binary to octal
Binary can be grouped directly into octal digits.
- Each octal digit = 3 binary digits (bits).
- Group binary digits into blocks of 3, starting from the right.
- Convert each block to a single octal digit.
Example: 101110₂ → group as 101 110 → 5 6 → 56₈. Check: 101110₂ = 46₁₀, and 56₈ = 46₁₀.
Octal to binary
Each octal digit expands to 3 binary digits.
Example: 725₈ → 7 = 111, 2 = 010, 5 = 101 → 111010101₂.
Programming notes
In the C programming language, a number starting with 0 is interpreted as octal.
- Example: 012 means 10 decimal, not twelve.
- This can lead to confusion.
- In modern languages, octal literals are often written with a prefix like 0o (Python, Rust).
Arithmetic in octal
Arithmetic is similar to decimal but carries occur after 7.
Addition example: 57₈ + 25₈ 57₈ = 47₁₀, 25₈ = 21₁₀ 47 + 21 = 68 68 in octal: 104₈. So 57₈ + 25₈ = 104₈.
Subtraction and multiplication follow the same principles, always working with base 8.