Binary to Octal Converter
Group binary digits in threes to get a base-8 number, and see why Unix still uses it.
Run ls -l on almost any Unix system and permissions show up as three digits, like 755. Those digits are octal, and the reason octal survives at all, decades after anyone needed it for much else, comes down to a single number: 3.
Why base 8 and not some other grouping
8 is 2 to the power of 3, so one octal digit represents exactly three binary digits, the same clean relationship hex has with four. Group the bits 111 101 101 into threes and read each group as its own digit — 7, 5, 5 — and you have converted binary to octal without any long division.
Octal had a bigger role in the 1960s and 70s, when some machines used word sizes divisible by three bits rather than four. Hexadecimal mostly won that fight once 8, 16 and 32-bit architectures standardised. Octal held on in exactly one place that still mattered: Unix permissions.
How chmod 755 is built from octal digits
| Octal digit | 3-bit binary | Permission | Meaning |
|---|---|---|---|
| 7 | 111 | rwx | read, write, execute |
| 6 | 110 | rw- | read, write |
| 5 | 101 | r-x | read, execute |
| 4 | 100 | r-- | read only |
| 0 | 000 | --- | no permission |
Reading chmod 755 with that table
A Unix file has three permission groups — owner, group, everyone else — and each one is exactly three bits: read, write, execute. Three bits fit one octal digit perfectly, which is why chmod 755 sets the owner to rwx (7), and both the group and everyone else to r-x (5): read and execute, no writing.
Try to describe the same permission set in hex and you would need to convert three-bit groups into four-bit ones first, which do not line up evenly. Octal fits the three-bits-per-group structure of Unix permissions exactly, and that is the whole reason it never got replaced.
Binary to octal questions
Why does one octal digit equal three binary digits?
Because 8 is 2 cubed, so exactly three bits are needed to cover the eight possible octal values, 0 through 7. Group any binary number into sets of three, starting from the right, and each group converts straight to one octal digit.
Why is chmod still written in octal instead of decimal?
Because Unix permissions are naturally three bits per group — read, write, execute — and three bits map to exactly one octal digit. A decimal number would not correspond cleanly to the underlying bit pattern at all.
What does chmod 644 actually mean?
6 is 110, read and write for the owner. 4 is 100, read-only for both the group and everyone else. It is a common setting for files that only the owner should be able to edit.
Do I pad binary to a multiple of three bits first?
Yes, if the total number of bits is not already divisible by three you add leading zeros until it is, then group from the right. Padding on the left never changes the value, only how evenly it splits into groups.
Is octal used anywhere outside Unix permissions today?
Rarely. It occasionally appears in older embedded systems and some legacy numeric literals in programming languages, but permissions are by far the place most people still encounter it.