Skip to content
BetterDL

Binary–octal conversion

Also called: binary to octal, octal to binary

Converting between binary and octal by swapping each 3-bit group for one octal digit (0 to 7), grouping from the right.

Since 8 = 2³, each octal digit stands for exactly three bits:

  • 0 = 000, 1 = 001, 2 = 010, 3 = 011
  • 4 = 100, 5 = 101, 6 = 110, 7 = 111

Binary → octal: split the bits into groups of 3, starting from the right. Pad the leftmost group with zeros on its left, then replace each group with its digit.

Octal → binary: replace each digit with exactly 3 bits, keeping its leading zeros. 2 must become 010; writing just 10 shifts every bit to its left into the wrong place.

The weights inside each group are 4, 2, 1. That's also why Unix permissions use octal: read = 4, write = 2, execute = 1. chmod 640 means 110 100 000: the owner can read and write, the group can read, everyone else gets nothing.

It's the same idea as binary hex conversion, with groups of 3 instead of 4.

1
128
1
64
0
32
1
16
1
8
1
4
0
2
0
1

Worked examples

Example

11011100₂ to octal

Group in threes from the right.

  1. 1.

    Groups: 11 | 011 | 100. Pad the first: 011 | 011 | 100.

  2. 2.

    011 = 3, 011 = 3, 100 = 4, so 334₈.

  3. 3.

    Check: 3 × 64 + 3 × 8 + 4 = 220, and 128 + 64 + 16 + 8 + 4 = 220.

Example

52₈ to binary

5 → 101 and 2 → 010, giving 101010₂. Check: 32 + 8 + 2 = 42 = 5 × 8 + 2.

Common mistakes

  • Grouping from the left.

  • Using 4-bit groups out of habit from hex.

  • Dropping the zero in 010 for the digit 2.

Practice Binary–octal conversion

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Binary–octal conversion is taught in Number Systems.