
Octal Explained: Convert Octal to Binary and Decimal
Octal is base eight and uses digits 0 through 7. Each digit corresponds to three binary bits, which makes it useful for Unix permissions such as chmod 755. This guide explains that mapping and shows how to convert between octal, binary, and decimal.
What Octal Is
Place values are powers of 8: …, 512, 64, 8, 1. The octal number 17 means 1×8 + 7 = 15 decimal. Write a leading 0 in some C dialects (0755), or use 0o755 in Python and modern JavaScript.
Why bother when hex exists? Because 8 = 2³, so one octal digit is exactly three bits. Hex wins for general byte work (four bits per digit). Octal wins when your natural group size is three bits, which is exactly the Unix rwx triplet.
Octal Digits to Binary (Three-Bit Groups)
Same idea as hex nibbles, but triples instead of fours.
| Octal | Binary | Decimal | rwx meaning |
|---|---|---|---|
| 0 | 000 | 0 | --- |
| 1 | 001 | 1 | --x |
| 2 | 010 | 2 | -w- |
| 3 | 011 | 3 | -wx |
| 4 | 100 | 4 | r-- |
| 5 | 101 | 5 | r-x |
| 6 | 110 | 6 | rw- |
| 7 | 111 | 7 | rwx |
Memorize 4=read, 2=write, 1=execute. Add them: 4+1=5 (read+execute), 4+2+1=7 (all). That arithmetic is why people say “chmod 644” instead of listing flags every time.
Unix Permissions: Owner, Group, Others
A common mode has three octal digits. Left to right: owner, group, others. Sometimes a fourth digit appears for setuid/setgid/sticky bits; ignore that until the basic three make sense.
Mode 755:
- 7 = rwx for owner
- 5 = r-x for group
- 5 = r-x for others
In binary that is nine bits:
Mode 644 is the usual “text file” default: owner read/write, everyone else read-only → 110 100 100. Mode 600 keeps a private key readable only by you.
Convert Octal to Decimal
Expand by place value. Example: 755 octal.
7×8² + 5×8¹ + 5×8⁰
7×64 + 5×8 + 5×1
448 + 40 + 5 = 493 decimal
You rarely need 493 when talking to chmod, but APIs sometimes want a decimal integer. Same bits either way.
Convert Decimal to Octal
Divide by 8, record remainders, read remainders bottom-up. Example: 493 → octal.
493 ÷ 8 = 61 remainder 5
61 ÷ 8 = 7 remainder 5
7 ÷ 8 = 0 remainder 7
Remainders upward: 755
Or convert decimal → binary first, then group bits in threes from the right. 493 in binary is 1 1110 1101; pad and group as 111 101 101 → 7 5 5. Use whichever path you make fewer mistakes on. The binary converter checks both.
Octal ↔ Binary Directly
Binary to octal: pad on the left to a multiple of 3, split, map each triple with the table.
Binary 101110
Groups: 101 110 → octal 56
Octal to binary: expand each digit to three bits.
Octal 47
100 + 111 → 100111
Octal vs Hex in Daily Work
Prefer hex for memory addresses, color codes, and file dumps. Prefer octal for Unix modes and a few legacy machine formats (some PDFs and old DEC documentation still show octal). Mixing them without a prefix is how bugs sneak into config files.
If you are already flipping hex and binary, the article on hex vs binary pairs well with this one. For dump reading, open the hex viewer rather than forcing octal onto byte streams.
Worked Permission Scenarios
| Goal | Mode | Binary |
|---|---|---|
| Public web script | 755 | 111101101 |
| Shared readable file | 644 | 110100100 |
| Private SSH key | 600 | 110000000 |
| Shared directory (sticky often 1777) | 1777 | 1 + 111111111 |
The sticky bit on /tmp (often shown as 1777) lets everyone create files while blocking deletion of other users' files. That fourth digit is still octal; it just flags special mode bits beyond rwx.
Language Gotchas
In C, an integer literal starting with 0 is octal. So 010 is eight, not ten. That has ruined more than one “why is my loop short?” debugging session.
JavaScript used to treat leading-zero decimals as octal in non-strict mode. Strict mode and modern style prefer 0o10 for octal and plain 10 for decimal. When encoding text, octal is unrelated; use text to binary or the ASCII table instead.
FAQ
Why not use hex for chmod?
You could, but three hex digits would not line up with three rwx groups. Octal's three-bit digits match the permission model exactly, which is why the tradition stuck.
Is 0755 different from 755?
Same permission bits. The leading zero is a notation hint (C octal literal) or a way to show a 4-digit mode with leading special bits equal to zero. The meaningful digits are still 7, 5, 5.
How do I convert octal on BinaryTranslator?
Open the binary converter, enter the value, and switch bases. For text payloads, stay on the main translator.
Does IEEE 754 use octal?
No. Floats are discussed in binary and hex. Use the IEEE 754 tool for those layouts.
Practice and Convert
Choose a permission mode such as 755, 644, or 600. Write its nine permission bits, convert the result to decimal, then back to octal. The three representations should describe the same value.
Run the numbers through the Binary Converter on BinaryTranslator.org. Related reading: decimal to binary, how to read binary, and binary to hex for the four-bit sibling of this three-bit trick.
Check the examples
Technical reference
Related Articles

Bitwise Flags in Practice: Permissions, Toggles, Masks
Use AND, OR, and XOR to pack feature flags and permission bits into a single integer, with examples you can try in the bitwise lab.

Binary to Hex Converter: Step-by-Step With Nibbles
Convert binary to hexadecimal by grouping bits into nibbles. Includes the reverse path (hex to binary) and a quick reference table.
Decimal to Binary Converter: Step-by-Step Guide (2026)
Learn how to convert decimal to binary by hand with two simple methods: division-by-2 and powers-of-2. Includes step-by-step examples, a conversion table, and a free converter.
