Decimal ↔ Octal Converter
Convert between decimal (base 10) and octal (base 8) instantly
Octal (base 8) is used most commonly in Unix/Linux file permissions via the chmod command (chmod 755) and in some legacy computing systems. This converter helps you switch between decimal and octal instantly.
Loading calculator...
How It Works
The Decimal-Octal Formula
How to convert between decimal and octal
Formula
Octal = Decimal ÷ 8 repeated (remainders) | Decimal = Σ(Octal digit × 8^position)
Variables
Powers of 8
Octal is base-8, so each digit represents a power of 8. The rightmost digit is 8⁰ (value 1), next is 8¹ (8), 8² (64), 8³ (512), 8⁴ (4096), and so on.
Octal Digits
Octal uses digits 0 through 7. It does not use 8 or 9, or any letters. If you see digits 8 or 9 or letters, it is not a valid octal number.
Decimal to Octal Conversion
Repeatedly divide the decimal number by 8, recording remainders (0-7). Read remainders from bottom to top to get the octal number.
Note: Decimal to octal conversion is most commonly used for Unix/Linux file permissions. The chmod command uses octal numbers to set read/write/execute permissions for owner, group, and others.
Step-by-Step Example
Converting decimal 493 to octal
Divide 493 by 8
493 ÷ 8 = 61 remainder 5
Divide quotient 61 by 8
61 ÷ 8 = 7 remainder 5
Divide quotient 7 by 8
7 ÷ 8 = 0 remainder 7
Read remainders from bottom to top
Remainders: 7, 5, 5 → 493 decimal = 755 octal
Reference Guide
| unit | value | note |
|---|---|---|
| Decimal: 255 | 377 | Maximum 3-digit octal (chmod 777) |
| Decimal: 493 | 755 | Common for web directories (755) |
| Decimal: 511 | 777 | Full permissions (rwxrwxrwx) |
| Decimal: 384 | 600 | Owner read/write only (rw-------) |
| Decimal: 420 | 644 | Common for files (rw-r--r--) |
| Decimal: 292 | 444 | Read-only for all (r--r--r--) |
Understanding chmod
How octal numbers control file permissions
The first digit sets permissions for the file owner. This is the most important digit because the owner has full control over permissions they can grant themselves.
Best for: Owner permission values: 4 = read (r), 2 = write (w), 1 = execute (x). Sum them for combinations: 6 = read+write (rw-); 7 = read+write+execute (rwx); 5 = read+execute (r-x); 4 = read-only (r--).
The second digit sets permissions for users in the group associated with the file. This is important for collaborative work where multiple people in the same team need consistent access.
Best for: Common group settings: 5 (r-x) for cd into directories; 4 (r--) for read-only files; 0 (---) for restricting access entirely.
The third digit sets permissions for everyone else (any user on the system who is not the owner and not in the group). These are the "public" permissions.
Best for: Web directories typically use 5 (r-x) or 7 (rwx). Web files typically use 4 (r--) or 6 (rw-). 0 (---) completely restricts public access.
Why Octal is Used for File Permissions
Unix and Linux systems represent file permissions as a 3-digit octal number because each permission type can be represented as a binary flag, and octal conveniently groups three binary bits into a single digit. Each permission has a binary value: read (r) = 4 (100 in binary), write (w) = 2 (010), execute (x) = 1 (001). The sum gives the octal digit: rwx = 4+2+1 = 7, rw- = 4+2+0 = 6, r-x = 4+0+1 = 5, r-- = 4+0+0 = 4, and so on. A full permission set is written as three octal digits: the first digit for the owner, the second for the group, and the third for others. For example, 755 means: owner has rwx (7), group has r-x (5), others have r-x (5). This system was invented by Dennis Ritchie and Ken Thompson during the early development of Unix at Bell Labs in the 1970s. The choice of octal over decimal was deliberate because octal aligns perfectly with the 9 binary permission flags (3 permissions × 3 user classes = 9 bits).
Key Features
💡 Pro Tips
- →In Linux/Unix, 755 (rwxr-xr-x) is the standard for directories, allowing the owner full access and everyone else only read and execute.
- →The chmod command also works with symbolic notation: chmod u=rwx,g=rx,o=rx is the same as chmod 755.
- →Web servers like Apache require directory execute permissions (5 or 7) to 'traverse' into directories, even if files inside are readable.
- →Never use 777 on a production web server if you don't have to — it allows any system user to write to your files, which is a significant security vulnerability.
- →When you need to find what octal permissions you need, use the decimal value from ls -l and convert it to octal using this calculator.
Common Mistakes
Using digits 8 or 9 in octal numbers
Octal only uses digits 0 through 7. Any number containing 8 or 9 is not a valid octal number. The converter will show an error if you try this.
Confusing chmod 755 vs 775
755 means owner=rwx, group=rx, others=rx. 775 means owner=rwx, group=rwx, others=rx. 775 allows group members to write, which may be too permissive in some environments.
Setting execute permissions on regular files unnecessarily
Only directories and executable files (programs, scripts) need execute permission. Setting execute on regular files can sometimes cause security warnings in some systems.
Using 000 when you mean to restrict all access
000 (no permissions) works but be aware that the root user can still access the file. For complete restriction, consider additional security measures like SELinux or AppArmor.
Research & Citations
All factual claims on this page are sourced from peer-reviewed research
- [1]
Ritchie, D., Thompson, K. (1974). The UNIX Time-Sharing System. Communications of the ACM, 17(7), pp. 365–375.
Original paper describing Unix file permissions and the octal representation system
- [2]
Linux Man Pages (2024). chmod — Change file mode bits. linux.die.net.
Official chmod manual page with octal permission documentation
View source - [3]
FreeBSD Documentation Project (2024). File Permissions — An Introduction. freebsd.org.
Explanation of octal permissions in Unix-like systems
View source
This calculator is a reference tool and does not constitute medical advice. For personalised sleep health guidance, consult a qualified healthcare provider.
Last updated: January 10, 2025
Creators
Developer
Table of Contents
Quick Facts
Related Tools
Privacy Guaranteed
Your data never leaves your browser. All calculations are 100% private.
Frequently Asked Questions
What is octal used for?
Octal (base 8) is most commonly used in Unix/Linux file permissions via the chmod command. It is also used in some legacy computing systems and as a compact way to represent binary data because three binary bits convert directly to one octal digit.
How do I convert decimal to octal?
Repeatedly divide the decimal number by 8, recording the remainder each time (0-7). Read the remainders from bottom to top. For example, 493 ÷ 8 = 61 remainder 5, 61 ÷ 8 = 7 remainder 5, 7 ÷ 8 = 0 remainder 7 → octal 755.
How do I convert octal to decimal?
Multiply each octal digit by 8 raised to its position (counting from 0 on the right), then sum the results. For example, octal 755 = (7 × 8² = 7 × 64 = 448) + (5 × 8¹ = 5 × 8 = 40) + (5 × 8⁰ = 5 × 1 = 5) = 493.
What is chmod 755?
chmod 755 is a Unix/Linux command that gives the file owner read, write, and execute permissions (7 = rwx) and gives the group and others read and execute permissions (5 = r-x). It is the standard permission setting for web directories.
What is the difference between 755 and 777?
755 gives full permissions to the owner (7 = read+write+execute) but only read+execute to group and others (5). 777 gives full permissions (read+write+execute) to everyone — owner, group, and others. 777 is generally considered a security risk on production servers.
What is chmod 644?
chmod 644 gives the owner read and write permissions (6 = rw-) and gives group and others read-only permissions (4 = r--). This is the standard permission setting for web files like HTML, CSS, and JavaScript.