What is Octal?
Octal is a base-8 number system that uses digits 0 through 7. Unlike decimal (base 10) or binary (base 2), octal groups binary digits into sets of three, which made it a natural shorthand for older computing systems.
Why Was Octal Used in Computing?
Before hexadecimal became the standard, octal was widely used in early computing โ particularly with 6-bit, 12-bit, and 36-bit architectures (which divided evenly into groups of 3 bits). Some early programming languages and Unix/Linux systems still use octal today for file permissions.
Unix File Permissions in Octal
If you've ever used chmod 755 or chmod 644 on a Linux system, you've used octal. Each digit represents three bits for owner, group, and others:
- 7 = 111 in binary = read + write + execute
- 6 = 110 in binary = read + write
- 5 = 101 in binary = read + execute
- 4 = 100 in binary = read only
- 0 = 000 in binary = no permissions
Octal to Decimal Conversion
Example: 57 in octal
- 5 ร 8^1 = 40
- 7 ร 8^0 = 7
- Total: 40 + 7 = 47 in decimal
Binary to Octal Shortcut
Group binary digits into sets of 3 from the right, then convert each group to a single octal digit.
- Binary: 101 111 โ Octal: 5 7 โ Octal 57
Convert between octal, decimal, binary and hex instantly with our number system converter.
Step-by-Step Conversion Examples
Setting Linux File Permissions with chmod
The most common real-world use of octal today is Unix/Linux file permissions. The command chmod 755 script.sh sets:
- Owner (7 = 111โ): read (4) + write (2) + execute (1) = rwx
- Group (5 = 101โ): read (4) + execute (1) = r-x
- Others (5 = 101โ): read (4) + execute (1) = r-x
The permission string displays as -rwxr-xr-x in ls -la. Common permission sets:
- 644: Owner read+write, group+others read only โ typical for config files
- 755: Owner full, group+others read+execute โ typical for directories and executables
- 600: Owner read+write only โ typical for SSH private keys
- 400: Owner read only โ certificate files and secrets
Binary breakdown of 644: 6 = 110 (rw-), 4 = 100 (r--), 4 = 100 (r--) โ displays as rw-r--r--. Understanding the binary mapping makes permission numbers intuitive rather than arbitrary codes to memorize.
Decimal to Octal Conversion: A Worked Example
Convert 365 (decimal) to octal using repeated division by 8:
- 365 รท 8 = 45 remainder 5
- 45 รท 8 = 5 remainder 5
- 5 รท 8 = 0 remainder 5
- Reading remainders bottom-up: 555 in octal
Verification: 5ร64 + 5ร8 + 5ร1 = 320 + 40 + 5 = 365 โ
The coincidence that 365 = 555โ makes it a useful mnemonic โ 365 days in a common year. Another memorable pair: 255 decimal = 377 octal (the maximum one-byte value), and 256 decimal = 400 octal (the beginning of the next "century").
Binary to Octal: The Three-Bit Grouping Method
Binary converts to octal directly by grouping bits in threes from the right โ no multiplication needed. Convert binary 110 101 001 to octal:
- 110 โ 6
- 101 โ 5
- 001 โ 1
- Result: 651 in octal
Verification: 6ร64 + 5ร8 + 1 = 384 + 40 + 1 = 425 decimal. Binary check: 256+128+32+8+1 = 425 โ
This grouping method works because 8 = 2ยณ โ each octal digit maps to exactly 3 binary bits. Hexadecimal (base 16 = 2โด) groups bits in fours, which aligns better with 8-bit bytes (two hex digits per byte). This alignment advantage is why hex replaced octal in modern computing after 8-bit architectures became dominant in the late 1970s.
Octal in Programming Languages
Octal literals appear in several programming languages with different syntax โ knowing the convention prevents subtle bugs:
- C/C++/Java: A leading zero means octal.
017= 15, not 17. Classic source of beginner bugs. - Python 3:
0o17= 15 (explicit0oprefix; Python 2's leading-zero syntax was removed) - JavaScript: Strict mode prohibits legacy
017; use0o17instead - Go:
0755in older code;0o755preferred since Go 1.13
A real-world pitfall in C: chmod(path, 0644) correctly uses octal 644 (rw-r--r--). But if a developer writes chmod(path, 0844) intending "owner read+execute + group read + others read," they actually pass octal 844 = decimal 548 โ which maps to unusual permission bits. Always use the explicit 0o prefix in Python and Go 1.13+, and double-check octal literals in C with a converter when in doubt.
Source: IEEE POSIX.1 standard (file permissions); programming language specifications (C11, Python 3, ECMAScript 2022). Last verified: May 2026.
Frequently Asked Questions
How do I convert decimal to octal?
Divide the decimal number by 8 repeatedly and collect remainders from last to first. Example: 83 รท 8 = 10 R3; 10 รท 8 = 1 R2; 1 รท 8 = 0 R1. Reading remainders bottom-up: 123 in octal. Check: (1ร64)+(2ร8)+3 = 64+16+3 = 83. Our Number Systems converter does this instantly.
Where is octal actually used today?
Octal is most commonly seen in Unix/Linux file permissions. The chmod command uses octal: chmod 755 means owner=7 (rwx), group=5 (r-x), others=5 (r-x). Each octal digit (0โ7) maps to three binary digits (read, write, execute), making permissions easy to express in a single digit per role.
Is octal the same as base 8?
Yes. Octal is another name for base 8 โ it uses only the digits 0 through 7. Each octal digit corresponds to exactly 3 binary digits: 0=000, 1=001, 2=010, 3=011, 4=100, 5=101, 6=110, 7=111. Before hexadecimal became dominant, octal was widely used as a compact binary shorthand in computing.
Convert between octal, decimal, binary, and hexadecimal instantly.
โก Binary & Number Systems Converter โ FreeAccuracy note: Conversion factors on SwiftConvertHub are sourced from NIST and IEC standards. Results are accurate for general use. For safety-critical or professional applications, verify results independently. Full disclaimer โ
Victor A. Calvo S. is a software engineer and digital entrepreneur who builds practical, free tools for developers, students, and professionals worldwide. He is the creator of SwiftConvertHub, InstantLinkHub, and Feexio. All conversion factors are cross-referenced against NIST and IEC standards. Learn more โ