Binary to octal converter
Type binary to get octal. Every three bits become one octal digit.
Prefixes 0b, 0o, 0x and spaces or underscores between digits are fine. A point starts the fraction.
How to convert binary to octal
Split the bits into groups of three, starting from the right, and pad the leftmost group with zeros if it’s short. Each group is one octal digit, because 8 is 23.
111 101 101 → 7 5 5 → 755
Binary to octal chart
| Octal | Binary | Decimal |
|---|---|---|
| 0 | 000 | 0 |
| 1 | 001 | 1 |
| 2 | 010 | 2 |
| 3 | 011 | 3 |
| 4 | 100 | 4 |
| 5 | 101 | 5 |
| 6 | 110 | 6 |
| 7 | 111 | 7 |
Common mistakes
Grouping from the left
1011 grouped from the left as 101 1 gives 51, which is wrong
Instead: Group from the right: 1 011, padded to 001 011, gives 13
Forgetting to pad
A leftover group of one or two bits read as if it had three
Instead: Pad the leftmost group with zeros to three bits
Using 4-bit groups
Four bits make a hex digit, not an octal one
Instead: Octal uses groups of three; hex uses groups of four
Octal and file permissions
Each octal digit is exactly three bits, which is why POSIX file modes use it: the three bits are read, write and execute. The permission string rwxr-xr-x is the bits 111 101 101, which is 755 in octal.
Sources and method
Conversions use exact whole-number arithmetic (JavaScript BigInt), so long numbers keep every digit. Fractions are kept as exact ratios; when the digits repeat, the repeating block is found and marked instead of rounded.
Questions
Why groups of three?
Three bits hold eight values, 000 to 111, exactly the octal digits 0 to 7.
What about a binary fraction?
Group the bits after the point in threes from the left, padding the last group with zeros on the right. 0.11 becomes 0.110, which is 0.6 in octal.