Octal Number System Explained: Base-8 Basics
What Is the Octal Number System?
The octal number system is a base-8 numeral system that uses eight digits: 0 through 7. Each position in an octal number represents a power of 8, just as each position in a decimal number represents a power of 10.
Octal emerged in computing because it provides a compact way to represent binary values. Every octal digit maps directly to exactly three binary digits (bits), making conversion between the two systems trivial.
How Octal Works
Place Values
In octal, the rightmost digit represents 8⁰ (1), the next represents 8¹ (8), then 8² (64), and so on:
| Position | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|
| Power of 8 | 8⁴ | 8³ | 8² | 8¹ | 8⁰ |
| Decimal value | 4096 | 512 | 64 | 8 | 1 |
The octal number 752 converts to decimal as:
7 × 64 + 5 × 8 + 2 × 1 = 448 + 40 + 2 = 490
Octal Prefix Convention
In many programming languages, octal numbers are written with a leading 0 or 0o:
| Language | Prefix | Example |
|---|---|---|
| C, Java, Python 2 | 0 | 0755 |
| Python 3, JavaScript, Rust | 0o | 0o755 |
| Bash | 0 or none | chmod 755 implies octal |
Python 3 dropped the bare 0 prefix because it caused confusion — 0123 looked decimal but was actually octal.
Converting Between Octal and Binary
This is where octal shines. Each octal digit maps to exactly three bits:
| Octal | Binary | Octal | Binary |
|---|---|---|---|
| 0 | 000 | 4 | 100 |
| 1 | 001 | 5 | 101 |
| 2 | 010 | 6 | 110 |
| 3 | 011 | 7 | 111 |
To convert octal to binary, replace each digit with its 3-bit equivalent:
Octal: 7 5 2
Binary: 111 101 010
To convert binary to octal, group bits from right to left in sets of three, then replace each group:
Binary: 1 101 011
Pad: 001 101 011
Octal: 1 5 3 → 153
This one-to-three mapping is why octal was popular on systems with word sizes divisible by 3 — like the 12-bit PDP-8 and the 36-bit IBM 700 series.
Converting Between Octal and Decimal
Octal to Decimal
Multiply each digit by its place value and sum:
752₈ = 7×64 + 5×8 + 2×1 = 490₁₀
Decimal to Octal
Repeatedly divide by 8 and collect remainders:
490 ÷ 8 = 61 remainder 2
61 ÷ 8 = 7 remainder 5
7 ÷ 8 = 0 remainder 7
Read remainders bottom-up: 752₈
Where Octal Is Used Today
Unix File Permissions
The most common modern use of octal is Unix file permissions. chmod 755 sets:
| Digit | Binary | Meaning |
|---|---|---|
| 7 | 111 | Read + Write + Execute |
| 5 | 101 | Read + Execute |
| 5 | 101 | Read + Execute |
Each digit represents owner, group, and others respectively.
Embedded Systems
Some micro controllers use octal for memory addresses and register values, particularly 12-bit and 24-bit architectures where the bit grouping aligns naturally with octal digits.
Legacy Systems
Older IBM mainframes and PDP minicomputers used octal as their primary notation. Some documentation and debugging tools still display values in octal for backward compatibility.
Octal vs. Hexadecimal
| Property | Octal | Hexadecimal |
|---|---|---|
| Base | 8 | 16 |
| Digits | 0–7 | 0–9, A–F |
| Bits per digit | 3 | 4 |
| Word alignment | 12, 24, 36 bits | 8, 16, 32, 64 bits |
| Modern usage | File permissions, legacy | Memory addresses, color codes |
Hexadecimal dominates modern computing because modern word sizes (8, 16, 32, 64 bits) are multiples of 4, making hex the natural grouping. Octal persists in niches where its 3-bit grouping aligns better.
Key Takeaways
- Octal is base-8, using digits 0 through 7
- Each octal digit maps to exactly three binary bits, making octal-binary conversion trivial
- The most common modern use is Unix file permissions (
chmod 755) - Octal prefixes vary by language:
0in older languages,0oin modern ones - Hexadecimal has largely replaced octal because modern word sizes align with 4-bit grouping
- Octal remains relevant on systems with word sizes divisible by 3
Related Guides
Try It Yourself
Convert between octal, decimal, binary, and hexadecimal instantly with our free Number Base Converter. Enter a value in any base and see all conversions at once.