# Binary to Octal Converter

## Converting Binary to Octal

Binary is the most basic language of computers. Everything, from simple text to full-length movies can be exepressed using binary. Computers use binary because it is a base 2 numbering system, in which each digit value has a value of one or zero. Thanks to the invention of the transistor, computers can represent binary numbers at an electronics level. Simple operations are implemented on the CPU and use binary values to compute.

Binary numbers are long, though. You need at least eight binary digits to represent a single character. This is where octal is useful, as it can represent an 3-digit binary number using a single octal value. This comes in handy when dealing with integers that are multiples of three bits wide. For example, Unix file permissions are represented by 12 bits, making octal a good choice for writing them.

The process of converting from binary to octal using grouping is fairly simple. Each group of three binary digits corresponds to a single octal digit.

1. Start with a given binary number, and pad it on the left with zeroes until its length is a multiple of three.
2. Split up the binary number, starting from the right, into equally sized three digit chunks.
3. Working from the right, convert each group into a single octal character using the table.

### Example

Converting `1011110102` to octal:

1. First chunk: `0102 = 28`
2. Second chunk: `1112 = 78`
3. Third chunk: `1012 = 58`

Thus, `1011110102 = 5728`

BinaryOct
0000
0011
0102
0113
1004
1015
1106
1117