What is Octal?
Octal is a base-8 number system that uses eight digits: 0, 1, 2, 3, 4, 5, 6, and 7. The name "octal" comes from the Latin word "octo" meaning eight. Unlike decimal (base-10) which is natural for humans, or binary (base-2) which is natural for computers, octal sits somewhere in between.
Octal was more popular in early computing because it provided a compact way to represent binary numbers. Each octal digit represents exactly three binary digits, making it easy to convert between binary and octal. While less common today, octal still has specific uses in computing.
Octal position values: ... 512 64 8 1
In octal, the rightmost position has value 1, then 8, then 64, then 512, and so on (each 8 times the previous value).
How to Convert Decimal to Octal
Converting decimal to octal uses the division-by-8 method, similar to the division-by-2 method for binary:
- Start with your decimal number - Let's convert 125 to octal as an example
- Divide by 8 - 125 ÷ 8 = 15 with remainder 5
- Write down the remainder - The remainder (5) becomes the rightmost digit
- Divide the quotient by 8 - Take 15 and divide by 8: 15 ÷ 8 = 1 remainder 7
- Write down this remainder - This becomes the next digit to the left
- Repeat until quotient is less than 8 - Keep dividing until the quotient is less than 8
- The last quotient becomes the leftmost digit - When the quotient is less than 8, it becomes the leftmost digit
- Read from bottom to top - The octal number is read from the last quotient to the first remainder
Complete example: Convert 125 to octal
125 ÷ 8 = 15 remainder 5
15 ÷ 8 = 1 remainder 7
1 is less than 8, so we stop here
Octal result: Read from last quotient to first remainder: 175
So 125 in decimal = 175 in octal
Our converter above shows you these steps for any number you enter.
Where is Octal Used Today?
While not as common as binary or hexadecimal, octal still has specific uses:
- Unix/Linux File Permissions - The most common use today. File permissions like 755 or 644 are octal numbers representing read/write/execute permissions
- Some Programming Languages - C, C++, and Java support octal literals (numbers starting with 0, like 0755)
- Digital Displays - Some older digital displays used octal representation
- Historical Computing - Early computers like the PDP-8 used octal extensively
- Aviation - Some aviation transponder codes use octal
- Teaching Number Systems - Octal is often taught as an intermediate step between binary and hexadecimal
Common Decimal to Octal Conversions
Here are some common decimal numbers and their octal equivalents:
| Decimal | Octal | What It Represents |
|---|---|---|
| 0 | 0 | Zero in all bases |
| 7 | 7 | Largest single octal digit |
| 8 | 10 | First "carry" in octal |
| 64 | 100 | 8 squared (8²) |
| 512 | 1000 | 8 cubed (8³) |
| 10 | 12 | Decimal 10 in octal |
| 100 | 144 | One hundred in octal |
| 255 | 377 | Maximum 8-bit value in octal |
| 777 | 1411 | Not the same as decimal 777! |
Octal File Permissions in Unix/Linux
The most practical use of octal today is in Unix/Linux file permissions. Each file has three sets of permissions:
- Owner permissions - What the file owner can do (read, write, execute)
- Group permissions - What users in the file's group can do
- Others permissions - What all other users can do
Each set has three bits representing read (4), write (2), and execute (1). These are added together to make an octal digit:
| Permission | Value | Meaning |
|---|---|---|
| Read | 4 | Can read the file |
| Write | 2 | Can modify the file |
| Execute | 1 | Can run the file as a program |
Example: Permission 755
7 (owner) = 4 + 2 + 1 = read, write, execute
5 (group) = 4 + 0 + 1 = read, no write, execute
5 (others) = 4 + 0 + 1 = read, no write, execute
So 755 means: Owner can do everything, group and others can read and execute
Octal vs. Other Number Systems
How does octal compare to other bases?
| Base | Digits | Pros | Cons |
|---|---|---|---|
| Binary (2) | 0, 1 | Natural for computers, simplest | Very long numbers, hard for humans |
| Octal (8) | 0-7 | Compact, easy binary conversion (3 bits per digit) | Less common today |
| Decimal (10) | 0-9 | Natural for humans, universal | No simple binary conversion |
| Hexadecimal (16) | 0-9, A-F | Very compact, easy binary conversion (4 bits per digit) | Uses letters, confusing at first |
Octal's advantage is that it converts easily to binary (each octal digit = 3 binary digits), but hexadecimal is more compact (each hex digit = 4 binary digits).