Convert any decimal (base 10) number to octal (base 8) instantly. Includes step-by-step division, binary and hex equivalents, and Unix file permission octal reference.
✓Verified: April 2026
Enter a whole number from 0 to 2,147,483,647.
Enter any non-negative integer
Octal (Base 8)
—
Was this calculator helpful?
✓ Thanks for your feedback!
Sources & Methodology
✓Octal (base 8) is defined in POSIX standards for Unix file permissions and in foundational computer science mathematics references.
Educational reference for base conversion including decimal to octal using repeated division by 8
Method: Repeated division by 8. Remainders are always 0–7 (octal digits only). Read remainders bottom to top. Permission display: When result is 3 digits (0–777), each octal digit maps to 3 binary bits (rwx) for Unix permission visualization.
JavaScript: n.toString(8) — exact for all safe integers.
⏱ Last reviewed: April 2026
How to Convert Decimal to Octal
Octal (base 8) is a number system that uses only the digits 0 through 7. While less common than binary or hexadecimal in modern computing, octal has one very practical everyday application: Unix and Linux file permissions. The chmod command uses octal numbers to represent the 9-bit permission mask for any file or directory, making octal essential knowledge for system administrators and developers.
The Division-by-8 Method
Octal = remainders of (n÷8) read bottom to top (digits 0–7 only)
Unix file permissions are stored as a 9-bit value split into three groups of 3 bits: owner (user), group, and others. Each 3-bit group represents read (r=4), write (w=2), execute (x=1). The sum of these values gives one octal digit per group. This is why chmod takes octal arguments like 755 or 644.
chmod
Octal
Binary
Permissions
Typical Use
chmod 777
777
111 111 111
rwxrwxrwx
All permissions (insecure)
chmod 755
755
111 101 101
rwxr-xr-x
Directories, executables
chmod 644
644
110 100 100
rw-r--r--
Regular files, web content
chmod 600
600
110 000 000
rw-------
Private files, SSH keys
chmod 444
444
100 100 100
r--r--r--
Read-only for everyone
chmod 000
000
000 000 000
----------
No permissions
Octal Digit Reference
Decimal
Octal
Binary (3-bit)
Unix meaning
0
0
000
--- (no access)
1
1
001
--x (execute only)
2
2
010
-w- (write only)
3
3
011
-wx (write + execute)
4
4
100
r-- (read only)
5
5
101
r-x (read + execute)
6
6
110
rw- (read + write)
7
7
111
rwx (full access)
Converting Octal in Programming Languages
Python:oct(255) → '0o377' | oct(255)[2:] → '377'
JavaScript:(255).toString(8) → '377'
Java:Integer.toOctalString(255) → '377'
C:printf("%o", 255) → 377
Excel:=DEC2OCT(255) → 377
💡 Octal vs. Binary shortcut: Each octal digit = exactly 3 binary bits. To convert octal 377 to binary: 3=011, 7=111, 7=111 → 011111111 = 11111111 (decimal 255). This makes octal a compact shorthand for binary, with 3 bits per digit instead of hex’s 4 bits per digit.
Frequently Asked Questions
Divide by 8 repeatedly, recording remainders 0–7 until quotient = 0. Read remainders bottom to top. Example: 255÷8=31r7, 31÷8=3r7, 3÷8=0r3 → read bottom to top: 377.
Decimal 8 = octal 10. Since 8 is the base of octal, it is the first two-digit octal number, just as 10 is the first two-digit decimal number. Octal 10 = 1×8 + 0×1 = 8.
Unix permissions are 3 groups of 3 bits each (rwx for owner, group, others). Each 3-bit group maps perfectly to one octal digit (0–7). chmod 755 = 111 101 101 binary = rwxr-xr-x. Octal is the most compact way to express these 9-bit permission masks.
chmod 755: 7=111(rwx), 5=101(r-x), 5=101(r-x). Binary: 111101101. Owner gets full access; group and others get read+execute only (no write). Standard for executable scripts and web directories.
chmod 644: 6=110(rw-), 4=100(r--), 4=100(r--). Binary: 110100100. Owner can read and write; group and others can only read. Standard for regular files, web server content, and configuration files.
Use oct(n): oct(255) returns '0o377'. Without prefix: oct(255)[2:] returns '377'. Formatted: format(255,'o') returns '377'. The 0o prefix signals an octal literal in Python 3 source code.
Octal uses only digits 0, 1, 2, 3, 4, 5, 6, 7. The digits 8 and 9 do not exist in octal. Each octal digit represents exactly 3 binary bits (a triad), compared to hex which uses 4 bits per digit.
Each octal digit = 3 binary bits: 0=000, 1=001, 2=010, 3=011, 4=100, 5=101, 6=110, 7=111. Conversion is direct: octal 377 = binary 011111111 = 11111111. Three binary digits always = one octal digit.
Octal is used in: Unix/Linux file permissions (chmod), string escape sequences (\077 = octal 63), assembly language for older processors (PDP-8), and some network protocols. Modern computing primarily uses hex, but octal remains essential for file permissions.
Octal = 3 bits per digit; Hex = 4 bits per digit. Hex is preferred in modern computing because 4 bits divides cleanly into 8-bit bytes (2 hex = 1 byte). Octal requires 2.67 digits per byte, making it less aligned. But for 3-bit Unix permission groups, octal is the perfect fit.
=DEC2OCT(255) returns 377. =DEC2OCT(255,6) returns 000377 (6 digits padded). Excel supports values from -536,870,912 to 536,870,911. For values outside this range, use Python or JavaScript instead.