PureDevTools

Octal Converter

Convert between octal, decimal, hex, and binary — with chmod permissions reference

All processing happens in your browser. No data is sent to any server.

Octal Converter

Input base

Octal (base 8)

OCT

Decimal (base 10)

DEC493

Hexadecimal (base 16)

HEX1ED

Binary (base 2)

BIN111101101

All bases

OCT755
DEC493
HEX1ED
BIN111101101
Octal chmod permissions reference ▸
OctalBinaryDecimalPermissions
755111 101 101493rwxr-xr-x (common executable)
644110 100 100420rw-r--r-- (common file)
777111 111 111511rwxrwxrwx (full access)
600110 000 000384rw------- (private key)
700111 000 000448rwx------ (private dir)
000000 000 0000---------- (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.

OctalBinaryDecimal
00000
10011
20102
30113
41004
51015
61106
71117

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:

OctalSymbolicMeaning
755rwxr-xr-xNormal executable — owner full, others read+execute
644rw-r—r—Normal file — owner read/write, others read-only
600rw-------Private file — owner only (SSH keys, .env files)
700rwx------Private directory — owner only
777rwxrwxrwxFull access for everyone (avoid in production)
444r—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.

Related Tools

More Encoding & Crypto Tools