We know that binary and octal are two different kinds of number systems whose bases are 2 and 8 respectively, i.e. they use 2 and 8 digits respectively to represent their numbers and these numbers are 0, 1 (for binary) and 0, 1, 2, 3, 4, 5, 6, 7 (for octal). Now we can transform any numbers of these number system to other type of number system directly without going through the decimal numbers.
Hence to transform a binary number into octal number, we can first convert it into decimal number and then convert that number into octal number or we can convert the binary number directly into an octal number, certainly the second method is more adaptable. This is also true for the reverse function, i.e. to transform an octal number into binary number. The two methods are described in the following articles.
Binary to Octal Conversion
As the binary numbers are comprised of only 0 and 1 we have to first divide the binary number into group of 3 digits starting from the right most side, and balancing the number of digits by putting appropriate number of zeroes. Now we have certain numbers of group of binary numbers, then we have to convert those groups into decimal numbers and write in the same order in which they used to be. Now this is the octal equivalent of that binary number. If we consider an example, this will be very easy to understand.
Let us take a binary number say 1011010012
Now dividing it into group of three digits we will find the following pattern
Now writing the equivalent decimal number of each group we get
5 | 5 | 1
So the equivalent octal number is 5518.
Octal to Binary Conversion
Now if we just imagine the reverse of the above explained operation we will be able to find out the method for converting octal number into binary number ourselves.
In this case each of the digits of the octal number is converted into its equivalent binary number and they are merged into the same order they were when they were as octal numbers, the leftmost zeroes are omitted from the number and we get the equivalent binary number. An example is given hereby to explain the method easily.
Let us take a number 348
Now the binary equivalent of 3 is 011 and that of 4 is 100.
So, the desired binary equivalent of the octal number is 111002.