Decimal to Octal Converter
Convert decimal (base 10) numbers to octal (base 8).
Octal
Decimal to octal, explained
Octal is the base-8 number system, using digits 0–7. Each octal digit maps to exactly three binary bits, which is why octal shows up in Unix file permissions (e.g. chmod 755). To convert, repeatedly divide by 8 and read the remainders bottom-up — so 64 becomes 100. Conversion runs entirely in your browser.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Producing a numeric file-permission value for a chmod command from a computed number.
- Converting a decimal value for a system or a protocol that specifies octal.
- Checking a permission value's three-digit octal form against the bits you intended.
- Producing an octal escape for a string literal.
- Working through a base-conversion exercise where base eight groups bits in threes.
Frequently Asked Questions
- How do I convert by hand?
- Divide by 8 repeatedly and read the remainders bottom-up: 255 ÷ 8 = 31 r 7, 31 ÷ 8 = 3 r 7, so 377. Alternatively convert to binary and group in threes, which is faster and less error-prone.
- Why does a byte max out at 377?
- Because 8 bits split into three-bit groups need three octal digits covering 9 bits, so the leading digit uses only 2 of them and ranges 0-3. Any octal byte value starting with 4-7 is out of range.
- Where will I actually use this?
- chmod permissions almost exclusively — 755, 644, 600. Each digit is one three-bit rwx field, which is exactly why permissions are quoted in octal rather than decimal or hex.
- What does a leading zero mean in code?
- In C, Java and older JavaScript it makes the literal OCTAL, so 0755 is 493, not 755. This has caused real bugs with zero-padded values. Python 3 rejects it outright and requires the explicit 0o prefix.
- Why did octal lose to hexadecimal?
- Word size. Octal groups three bits, which suited 12- and 36-bit machines like the PDP-8; hex groups four, which divides an 8-bit byte evenly. Once bytes became universal, hex was the natural fit.
- How do I read a Unix permission value?
- Each digit is one triple of read, write and execute — owner, group, others. So 755 is `rwxr-xr-x`, and the fourth leading digit, when present, carries setuid, setgid and the sticky bit.
- What is the umask and why is it octal too?
- A mask of permission bits to REMOVE from a new file's default, so 022 clears group and other write. It is octal for the same reason permissions are — three bits per digit maps exactly onto the triples.
Common errors and gotchas
- Forgetting the leading zero many contexts use to mark a value as octal, which changes how it is read.
- Producing more than three digits for a permission value, which no longer means what chmod expects.
- Confusing the octal form with the decimal one, where 755 and 493 are the same permissions written differently.
- Assuming the tool adds a prefix, when some targets require one and others treat it as part of the number.
- Converting a value above the field's range and getting a digit count the target silently truncates.
Related Converters tools
JSON to YAML
Convert JSON into clean, readable YAML instantly.
YAML to JSON
Convert YAML configuration into valid JSON.
JSON to XML
Convert JSON structures into nested XML markup.
HWB to HEX Converter
Convert an HWB color to HEX.
JSON to SQL
Turn a JSON array of objects into SQL INSERT statements.
CSV to XML
Convert CSV rows into structured XML records.
XML to CSV
Flatten repeated XML records into CSV rows.
INI to JSON
Parse INI config sections and keys into JSON.