Decimal to Octal Converter
Convert decimal to octal instantly, with 0o prefixes and Unix permission readings for values up to 7777.
About this number
What It Does
This converter writes a decimal number in octal (base 8). It is exact at any size and can add the 0o prefix. The most common reason to need octal today is file permissions, where a mode stored as a decimal integer — as some APIs and languages return it — has to be turned back into the familiar three digits; the tool shows the rwx reading for those values.
When to Use It
- An API or stat() call returned a file mode as a decimal number and you need the octal permission.
- You are writing an octal literal or escape sequence in code.
- You are working through base-conversion exercises.
- You are reading values from a legacy system that uses octal.
Worked Examples
493
755 in octal — the decimal that Node's fs.stat reports for an rwxr-xr-x file once the file-type bits are masked off.
420
644 — rw-r--r--. A decimal 420 in a config file is often a mangled 0644.
0755
Read as decimal seven hundred fifty-five, giving 1363 — and a warning, because many languages would treat 0755 as octal.
Features
How to Use
1. Type or paste a decimal number — or a list, one per line. 2. The octal value appears alongside, line for line. 3. Use the options to group digits or add a prefix, and the swap button to convert the other way.
Common Mistakes
- Converting a number through a JavaScript Number. Above 9,007,199,254,740,991 it silently rounds, so the last digits come out wrong. This tool uses BigInt and stays exact at any size.
- Forgetting that the same digits mean different values in different bases. 10 is ten in decimal, two in binary, eight in octal and sixteen in hex — always label which base a value is in.
- Treating a minus sign as how a computer stores a negative number. Hardware uses two's complement, so a negative value's bit pattern looks nothing like its positive counterpart.
Frequently Asked Questions
Related Tools
Conversion runs in your browser with exact integer arithmetic. Nothing is uploaded.