🔢 Octal Base Converter – Number Systems, Text Encoding & Unix Permissions
The Octal Base Converter is a comprehensive tool for developers, system administrators, and students who work with the base-8 (octal) number system. It converts octal values to binary, decimal, and hexadecimal, encodes and decodes text as octal byte sequences, and decodes Unix/Linux file permission codes into human-readable flags.
What Is Octal (Base-8)?
The octal numeral system uses eight digits: 0 through 7. Unlike binary (base-2) or hexadecimal (base-16), octal has a direct and natural relationship with binary — each octal digit maps to exactly 3 binary bits because 2³ = 8. This makes octal a compact shorthand for binary data without the letter-digit mixing of hex.
Historically, octal appeared in early computing architectures (PDP-8, IBM 360) and remains in wide use today for Unix/Linux file permissions via the chmod command.
3-Bit Grouping: The Octal-Binary Connection
Every octal digit corresponds to a unique 3-bit binary group. Converting between octal and binary is as simple as substituting groups:
000
001
010
011
100
101
110
111
Octal digit (top) → 3-bit binary equivalent (bottom)
For example, octal 755 expands digit-by-digit to binary 111 101 101, which equals decimal 493.
Common Conversion Formulas
Octal → Decimal
Σ digit × 8ⁿ (positional expansion)
755₈ = 7×64 + 5×8 + 5 = 493₁₀Decimal → Octal
Repeated division by 8, read remainders upward
493 ÷ 8 = 61 r 5 → 61 ÷ 8 = 7 r 5 → 7 ÷ 8 = 0 r 7 → 755Octal → Binary
Replace each digit with its 3-bit group
755₈ → 111|101|101₂Octal → Hex
Convert to decimal first, then to hex
755₈ → 493₁₀ → 1ED₁₆Unix File Permissions — The Most Common Octal Use Case
Unix and Linux systems encode file permissions as a 3-digit octal number where each digit represents a group (Owner, Group, Others) and the value is a bitmask of read (4), write (2), and execute (1):
rwxr-xr-x
Web content, executables
rw-r--r--
Config files, HTML
rwx------
Private directories
rw-------
SSH keys, secrets
rwxrwxrwx
Avoid in production
rwxr-xr-x+sticky
Shared dirs (/tmp)
The permission value for each group is calculated as: r=4, w=2, x=1. For example, rwx = 4+2+1 = 7 and r-x = 4+0+1 = 5, making 755 mean owner gets full access while group and others can only read and execute.
Text ↔ Octal Encoding
In C/C++ and Unix tools like od, text is often represented as octal byte sequences. The ASCII code of each character is expressed in base-8 and prefixed with a backslash (\110\145\154\154\157 = "Hello"). This tool supports:
- Space-separated octal bytes (standard
od -bformat) - C-style backslash literals (
\110\145) as used in C strings - Comma-separated format for CSV or data interchange
- Python/Shell prefix (
0o101) for scripting use
Who Uses This Tool?
🐧
Linux/Unix Admins
💻
C/C++ Developers
🎓
CS Students
🔐
Security Engineers
⚙️
Embedded Devs
Tips for Accurate Conversions
- Valid octal digits are 0–7 only. The digits 8 and 9 do not exist in base-8 — the tool will flag these as errors immediately.
- Use the step-by-step toggle on the Number Converter tab to see the mathematical derivation for learning and verification.
- The bit-grouping visualization shows how octal and binary digits align in 3-bit clusters, making it easy to visually verify conversions.
- For Unix permissions, 4-digit codes (like
1755) include special bits: setuid (4xxx), setgid (2xxx), and sticky bit (1xxx). - The tool supports integers up to 2⁵³ − 1 (JavaScript's safe integer limit). A warning appears for very large values.