- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# How to Convert Binary to Octal?

**Binary** is the simplest kind of number system that uses only two digits of 0 and 1 (i.e. value of base 2). Since digital electronics have only these two states (either 0 or 1), so binary number is most preferred in modern computer engineer, networking and communication specialists, and other professionals.

Whereas **Octal** number is one of the number systems which has value is 10 and it has only 8 symbols: 0, 1, 2, 3, 4, 5, 6, and 7.

## Conversion from Binary to Octal number system

Octal number system provides convenient way of converting large binary numbers into more compact and smaller groups. There are various ways to convert a binary number into octal number. You can convert using direct methods or indirect methods. First, you need to convert a binary into other base system (e.g., into decimal, or into hexadecimal). Then you need to convert it octal number.

Most Significant Bit (MSB) | Octal Point | Least Significant Bit (LSB) | |||
---|---|---|---|---|---|

8^{2} | 8^{1} | 8^{0} | 8^{-1} | 8^{-2} | 8^{-3} |

64 | 8 | 1 | 1/8 | 1/64 | 1/512 |

Since number numbers are type of positional number system. That means weight of the positions from right to left are as 8^{0}, 8^{1}, 8^{2}, 8^{3}
*and so on*for the integer part and weight of the positions from left to right are as 8^{-1}, 8^{-2}, 8^{-3}*and so on*.for the fractional part.

**Example** − Convert binary number 10010110 into octal number.

First convert this into decimal number = (10010110)_{2}= 1x2^{7}+0x2^{6}+0x2^{5}+1x2^{4}+0x2^{3}+1x2^{2}+1x2^{1}+0x2^{0}= 128+0+0+16+0+4+2+0 = (150)_{10}Then, convert it into octal number = (150)_{10}= 2x8^{2}+2x8^{1}+6x8^{0}= (226)_{8}which is answer.

However, there is also a direct method to convert a binary number into octal number − grouping which is explained as following below.

## Using Grouping

Since, there are only 8 digits (from 0 to 7) in octal number system, so we can represent any digit of octal number system using only 3 bit as following below.

Octal Digit Value | Binary Equivalent |
---|---|

0 | 000 |

1 | 001 |

2 | 010 |

3 | 011 |

4 | 100 |

5 | 101 |

6 | 110 |

7 | 111 |

So, if you make each group of 3 bit of binary input number, then replace each group of binary number from its equivalent octal digits. That will be octal number of given number number. Note that you can add any number of 0’s in leftmost bit (or in most significant bit) for integer part and add any number of 0’s in rightmost bit (or in least significant bit) for fraction part for completing the group of 3 bit, this does not change value of input binary number.

So, these are following steps to convert a binary number into octal number.

Take binary number

Divide the binary digits into groups of three (starting from right) for integer part and start from left for fraction part.

Convert each group of three binary digits to one octal digit.

This is simple algorithm where you have to grouped binary number and replace their equivalent octal digit.

**Example-1** − Convert binary number 1010111100 into octal number. Since there is no binary point here and no fractional part. So,

Therefore, Binary to octal is.

= (1010111100)_{2}= (001 010 111 100)_{2}= (1 2 7 4)_{8}= (1274)_{8}

**Example-2** Convert binary number 0110 011.1011 into octal number. Since there is binary point here and fractional part. So,

Therefore, Binary to octal is.

= (0110 011.1011)_{2}= (0 110 011 . 101 1)_{2}= (110 011 . 101 100)_{2}= (6 3 . 5 4)_{8}= (63.54)_{8}

These are above simple conversions binary number to octal number.

- Related Articles
- How to Convert Octal to Binary?
- How to Convert Decimal to Binary, Octal, and Hexadecimal using Python?
- C++ Program to Convert Octal Number to Binary Number
- C++ Program to Convert Binary Number to Octal and vice-versa
- How to Convert Decimal to Octal?
- How to convert a Decimal to Octal using C#?
- Java Program to convert integer to octal
- Java Program to convert Decimal to Octal
- Golang Program to convert Decimal to Octal
- Swift Program to convert Decimal to Octal
- C++ Program to convert Decimal Numbers to Octal
- C# program to convert decimal to Octal number
- Java Program to convert int to Octal String
- How to convert an integer to a octal string in Python?
- Convert decimal integer to octal in Java