How to Convert Octal Numbers
Octal (base-8) uses the digits 0 through 7 and was the dominant shorthand for binary in 1960s and 1970s computing — an era when word sizes (6, 12, 24, 36 bits) were divisible by 3. Today you encounter octal every time you set Unix/Linux file permissions: the command chmod 755 is three octal digits, each encoding three binary permission flags. Because 8 = 2³, one octal digit represents exactly three binary bits — making octal-to-binary and binary-to-octal conversions pure look-up operations with no arithmetic at all.
How Octal Positional Notation Works
Just as decimal positions represent powers of 10 (1, 10, 100, …), octal positions represent powers of 8. The rightmost digit is 8⁰ = 1, the next is 8¹ = 8, then 8² = 64, 8³ = 512, and so on. To find the decimal value of any octal number, multiply each digit by its positional power of 8 and add the products.
| Position | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|
| Power of 8 | 8⁴ | 8³ | 8² | 8¹ | 8⁰ |
| Decimal value | 4096 | 512 | 64 | 8 | 1 |
Octal → Decimal: Positional Notation
- Label each octal digit's position from 0 (rightmost) increasing to the left.
- Multiply each digit by 8 raised to its position (8⁰=1, 8¹=8, 8²=64, 8³=512, …).
- Add all the products together.
Worked Example 1 — Convert (52)₈ to Decimal
A two-digit octal number. Position 1 has digit 5, position 0 has digit 2.
Worked Example 2 — Convert (374)₈ to Decimal
A three-digit octal number. Each digit is multiplied by the corresponding power of 8.
| Digit | 3 | 7 | 4 |
|---|---|---|---|
| Position | 2 | 1 | 0 |
| Positional value | 64 | 8 | 1 |
| Product | 192 | 56 | 4 |
Octal → Binary: Direct 3-Bit Substitution
Because 2³ = 8, each octal digit corresponds to exactly 3 binary bits. The full mapping has only 8 entries — memorize it once and you can convert any octal number to binary instantly, without any arithmetic. Just replace each octal digit with its 3-bit equivalent.
| Octal digit | 3-bit binary | Octal digit | 3-bit binary |
|---|---|---|---|
| 0 | 000 | 4 | 100 |
| 1 | 001 | 5 | 101 |
| 2 | 010 | 6 | 110 |
| 3 | 011 | 7 | 111 |
Worked Example — Convert (374)₈ to Binary
Replace each of the three octal digits with its 3-bit binary equivalent:
| Octal digit | 3 | 7 | 4 |
|---|---|---|---|
| 3-bit binary | 011 | 111 | 100 |
Worked Example — Convert (52)₈ to Binary
| Octal digit | 5 | 2 |
|---|---|---|
| 3-bit binary | 101 | 010 |
Octal → Hexadecimal: Via Binary
There is no direct octal-to-hex table because 8 and 16 do not share a simple power relationship. The standard approach uses binary as an intermediate step: expand each octal digit to 3 bits, concatenate all bits into one binary string, then regroup those bits into 4-bit chunks and convert each chunk to a hex digit.
- Expand each octal digit to its 3-bit binary equivalent.
- Concatenate all bits into one binary string.
- Pad the leftmost end with zeros until the total bit count is a multiple of 4.
- Split into 4-bit groups from right to left.
- Convert each 4-bit group to its hex digit (0–9, A–F).
Worked Example — Convert (374)₈ to Hexadecimal
Step 1: expand to binary — (374)₈ → 011 111 100 → binary string 011111100 (9 bits). Step 2: pad to 12 bits → 000011111100. Step 3: split into 4-bit groups: 0000 | 1111 | 1100.
| 4-bit group | 0000 | 1111 | 1100 |
|---|---|---|---|
| Decimal value | 0 | 15 | 12 |
| Hex digit | 0 | F | C |
Real-World Use: Unix File Permissions
Unix and Linux represent file permission sets as three binary flags — read (r), write (w), execute (x) — for each of three groups: owner, group, and others. Since each flag is a single bit and each group has 3 flags, one octal digit perfectly encodes one group's permissions. This is why chmod uses three octal digits.
| Octal digit | Binary (rwx) | Permission meaning |
|---|---|---|
| 7 | 111 | read + write + execute (full access) |
| 6 | 110 | read + write |
| 5 | 101 | read + execute |
| 4 | 100 | read only |
| 3 | 011 | write + execute |
| 2 | 010 | write only |
| 1 | 001 | execute only |
| 0 | 000 | no permissions |
- Octal Converter — Convert octal numbers to binary, decimal, and hex instantly
- Octal Conversion Formula — Positional notation formula and bit-substitution method explained
Frequently Asked Questions
What digits are valid in an octal number?
Only 0 through 7. The digits 8 and 9 do not exist in octal — octal base-8 can only use digits whose value is less than the base. If you see an 8 or 9 in a supposed octal number, it is not a valid octal value.
Why is octal less common than hexadecimal today?
Modern computing is built around 8-bit bytes. One byte = 8 bits = exactly two hex digits (since 2⁴ = 16). Octal's 3-bit grouping doesn't align neatly with 8-bit bytes — you need 3 octal digits for 9 bits, but a byte has only 8. Hex's 4-bit grouping aligns perfectly. This is why hex became the dominant compact representation for binary data.
Is octal still used in modern computing?
Yes, though mainly in two places: Unix/Linux file permissions (chmod) and escape sequences in programming languages. Languages like C, Python, and JavaScript allow octal literals using a leading zero (0755 in C) or the 0o prefix (0o755 in Python). Octal escape sequences like \077 also appear in some string contexts.
How do I convert a decimal number to octal?
Use the repeated division algorithm: divide by 8, record the remainder, divide the quotient by 8 again, and repeat until the quotient is 0. Read the remainders from bottom to top. For example, 252 ÷ 8 = 31 R 4, 31 ÷ 8 = 3 R 7, 3 ÷ 8 = 0 R 3 → read bottom to top: 374₈.