... LIVE
Enter a whole number from 0 to 2,147,483,647.
Enter any non-negative integer
Octal (Base 8)

Sources & Methodology

Octal (base 8) is defined in POSIX standards for Unix file permissions and in foundational computer science mathematics references.
💻
POSIX Standard — sys/stat.h File Permission Bits
Official POSIX definition of octal permission bits used in Unix/Linux chmod commands
📖
Khan Academy — Number Systems in Computing
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)
Example: Convert decimal 255 to octal.
255 ÷ 8 = 31 remainder 7
31 ÷ 8 = 3 remainder 7
3 ÷ 8 = 0 remainder 3
Read bottom to top: 377
Verify: (3×64) + (7×8) + (7×1) = 192 + 56 + 7 = 255 ✓

Unix File Permissions — Octal Reference (chmod)

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.

chmodOctalBinaryPermissionsTypical Use
chmod 777777111 111 111rwxrwxrwxAll permissions (insecure)
chmod 755755111 101 101rwxr-xr-xDirectories, executables
chmod 644644110 100 100rw-r--r--Regular files, web content
chmod 600600110 000 000rw-------Private files, SSH keys
chmod 444444100 100 100r--r--r--Read-only for everyone
chmod 000000000 000 000----------No permissions

Octal Digit Reference

DecimalOctalBinary (3-bit)Unix meaning
00000--- (no access)
11001--x (execute only)
22010-w- (write only)
33011-wx (write + execute)
44100r-- (read only)
55101r-x (read + execute)
66110rw- (read + write)
77111rwx (full access)

Converting Octal in Programming Languages

💡 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.
Decimal 255 = octal 377. Division: 255÷8=31r7, 31÷8=3r7, 3÷8=0r3 → 377. Verify: (3×64)+(7×8)+(7×1)=192+56+7=255. In binary: 11111111.
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.
Decimal 64 = octal 100. Division: 64÷8=8r0, 8÷8=1r0, 1÷8=0r1 → 100. Verify: 1×64+0+0=64. Octal 100 = decimal 64 = binary 1000000 = hex 40.
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.
Related Calculators
Popular Calculators
🧮

Missing a Math Calculator?

Can’t find the math calculator you need? Tell us — we build new ones every week.