Octal Converter
Convert between octal, decimal, hex, and binary — with chmod permissions reference
Octal Converter
Input base
Octal (base 8)
Decimal (base 10)
Hexadecimal (base 16)
Binary (base 2)
All bases
Octal chmod permissions reference ▸
| Octal | Binary | Decimal | Permissions |
|---|---|---|---|
| 755 | 111 101 101 | 493 | rwxr-xr-x (common executable) |
| 644 | 110 100 100 | 420 | rw-r--r-- (common file) |
| 777 | 111 111 111 | 511 | rwxrwxrwx (full access) |
| 600 | 110 000 000 | 384 | rw------- (private key) |
| 700 | 111 000 000 | 448 | rwx------ (private dir) |
| 000 | 000 000 000 | 0 | ---------- (no access) |
Octal (base 8) is less common than hex in modern code, but it appears constantly in one critical Unix/Linux context: file permissions. Every chmod command, every ls -l output, every permission mask in system calls uses octal. This converter translates between octal and all other common bases with a chmod reference built in.
What Is Octal (Base 8)?
Octal uses digits 0–7. Each octal digit represents exactly 3 binary bits — which is why it fits permission triplets (read=4, write=2, execute=1) so neatly.
| Octal | Binary | Decimal |
|---|---|---|
| 0 | 000 | 0 |
| 1 | 001 | 1 |
| 2 | 010 | 2 |
| 3 | 011 | 3 |
| 4 | 100 | 4 |
| 5 | 101 | 5 |
| 6 | 110 | 6 |
| 7 | 111 | 7 |
Octal ↔ Binary: The Trivial Case
Since 8 = 2³, converting between octal and binary is as simple as splitting into 3-bit groups:
Binary: 111 101 101
Octal: 7 5 5 → 755
No arithmetic needed — just a straight substitution.
Octal ↔ Decimal Conversion
Octal to decimal: multiply each digit by its power of 8.
755₈ = 7×8² + 5×8¹ + 5×8⁰
= 7×64 + 5×8 + 5×1
= 448 + 40 + 5 = 493
Decimal to octal: divide by 8 repeatedly and read remainders in reverse.
493 ÷ 8 = 61 r 5 → 5
61 ÷ 8 = 7 r 5 → 5
7 ÷ 8 = 0 r 7 → 7
Result (bottom to top): 755
Unix File Permissions: Why Octal Is Everywhere
Unix permissions have three groups — owner, group, others — each with three flags: read (r=4), write (w=2), execute (x=1). The sum of the active flags per group forms one octal digit.
rwxr-xr-x:
owner: r(4)+w(2)+x(1) = 7
group: r(4)+x(1) = 5
others: r(4)+x(1) = 5
→ chmod 755
Common permission patterns:
| Octal | Symbolic | Meaning |
|---|---|---|
| 755 | rwxr-xr-x | Normal executable — owner full, others read+execute |
| 644 | rw-r—r— | Normal file — owner read/write, others read-only |
| 600 | rw------- | Private file — owner only (SSH keys, .env files) |
| 700 | rwx------ | Private directory — owner only |
| 777 | rwxrwxrwx | Full access for everyone (avoid in production) |
| 444 | r—r—r— | Read-only for everyone |
In C system calls: open(path, O_CREAT, 0644) — the leading zero is Python/C’s octal literal syntax.
Octal in Programming Languages
Octal literals are written differently by language:
// C / C++: leading zero
int perms = 0755;
// JavaScript (strict mode): 0o prefix
const perms = 0o755;
// Python 3: 0o prefix
perms = 0o755
// Java: leading zero (same as C)
int perms = 0755;
Watch out: In JavaScript (non-strict mode) and C, a number starting with 0 followed by digits 0–7 is interpreted as octal. 010 = 8, not 10. This is a frequent source of bugs.
Octal in the Context of Older Systems
Before hex became dominant, octal was the standard way to represent binary data because early computers (DEC PDP series, early mainframes) had 12-bit, 24-bit, or 36-bit word sizes — all cleanly divisible by 3. Modern 8-bit bytes and 16/32/64-bit words divide more cleanly by 4, which is why hex won. But the Unix permission system was designed for those early machines, and the octal convention was retained.
Frequently Asked Questions
Why does chmod 0755 and chmod 755 both work?
The leading zero is an octal prefix in C (and accepted by chmod), but chmod interprets the argument as octal regardless of the leading zero. Both are equivalent.
What’s the difference between octal 10 and decimal 10? Octal 10₈ = 1×8 + 0×1 = 8 decimal. Always check which base is being used in documentation — a leading zero in C code is a strong hint it’s octal.
When should I use octal over hex in modern code? Almost exclusively for Unix permission modes. Everywhere else, hex or binary literals are clearer.
Privacy
All conversions run entirely in your browser. No data is transmitted to any server.