Octal To Binary And Binary To Octal Numbers Conversion

Octal Numbers to Binary Numbers and Binary Numbers to Octal Numbers

The conversion between binary numbers and octal numbers is very easy and straightforward task. Let's start.

Key Questions:
  • Convert octal number into binary number
  • Convert binary number into octal number
  • Convert octal fractional number into binary fractional number
  • Convert binary fractional number into octal fractional number


Octal numbers
00
01
02
03
04
05
06
07
Binary numbers
00
01
10
11
100
101
110
111

Binary to Octal Conversion:


Whenever converting from binary to octal, its easy, just make group of 3 bits. And convert each 3 bit group to its equivalent octal value. But why we make group of 3 bits? Because 3 bits number in binary the total values can be expressed are 2n or largest possible value for a 3 bit number is 2n-1=7. The total digits or unique symbols in base 8 (octal) syatem are 8.
For integers start making groups from right to left.
Example 01011101)2
   010 011 101
                      
                                   Start making group of 3 bits from here

We have a 8 bit number. Start making group of 3 bits from right. You can make 2 groups easily. For 3rd  3 bit group we have to add extra 0. As shown above

For fractional part start making group from left to right.
Example 0.1111000111)2

0.111 100 011 100
                                ⇗

          Start making group of 3 bits from here


Example#01:110111011.11010)2=?)2
Making group of 3 bits
110 111 011 . 110 100

Binary number
110
111
011
.
110
100
Octal number
6
7
3
.
6
4

Answer 110111011.11010)2=673.64)8


Example#02: 101111001.010101)2
Making group of 3 bits
101 111 001.010 101

Binary number
101
111
001
.
010
101
Octal number
5
7
1
.
2
5

Answer 110111011.11010)2=571.25)8


Example#03: 1111110011111001)2=?)8
Making group of 3 bits
001 111 110 011 111 001

Note: add two zeros on the left in order to make group of 3 bits.

Binary number
001
111
110
011
111
001
Octal number
1
7
6
3
7
1

Answer  1111110011111001)2=176371)8

Octal to Binary Conversion:

The conversion method is to take individual octal digit and convert it in binary. Make sure convert in the way that each octal digit should represent in 3 bit binary group.
For example if
                      1)8 =001)2  right way
                   
                      1)8 =1)2 wrong way

Note: this is wrong for this conversion technique only. Otherwise it is obviously the same.
1)8 =1)2

Example#01:673.64)8= ?)2
Represent each octal digit in 3 bit binary number.

Octal number
6
7
3
.
6
4
Binary number
110
111
011
.
110
100

Answer 673.64)8= 110111011.110100)2
Or 673.64)8= 110111011.1101)2

Note: you can remove the right most 0s that are unnecessary.


Example#02: 571.25)8?)2
Represent each octal digit in 3 bit binary number.

Octal number
5
7
1
.
2
5
Binary number
101
111
001
.
010
101

Answer 571.25)8= 101111001.010101)2


Example#03: 176371)8=?)2

Represent each octal digit in 3 bit binary number.


Octal number
1
7
6
3
7
1
Binary number
001
111
110
011
111
001

Answer 176371)8= 1111110011111001)2

Decimal to Hexadecimal and Hexadecimal to Decimal Conversion Solved Examples

Conversion Between Decimal and Hexadecimal Numbers
The method of conversion in between hexadecimal and decimal numbers are same as conversion between Octal and decimal numbers. I tried to make explanation as easy as possible. I provide 2 tables, one is for calculated powers of 16 and the other is for hexadecimal numbers equivalent in decimal numbers.

Key Questions:
  • Conversion between decimal and hexadecimal numbers
  • How to convert decimal fraction into hexadecimal fraction
  • How to convert hexadecimal fraction into decimal fraction

164
163
162
161
160
16-1
16-2
65536
4096
256
16
1
0.0625
0.0039


Hexa-decimal
00
01
02
03
04
05
06
07
08
09
0A
0B
0C
0D
0E
0F
Decimal
00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15

Decimal to Hexadecimal Conversion:
As we see in decimal to binary conversion and decimal to octal conversion when  converting From decimal to binary number system we use repeated division by 2 and if decimal to octal number system we use repeated division by 8. So this time we are working with hexadecimal numbers so the repeated division by 16 method is used. And if we have mantissa or fractional part then we use repeated multiplication by 16 method. Let's start with examples.


Example#01:4859)10= ?)16

4859/16 =303       remainder 11)10=B)16
303/16= 18           remainder 15)10=F)16
18/16=1                remainder 2)10=2)16
Look at the highlighted numbers 12FB)16
Answer 4859)10= 12FB)16


Example#02:23456.235)10= ?)16
Solve integer part using division by 16
23456/16=1466      remainder 0 =0)16
1466/16=91            remainder 10)10=A)16
91/16=5                  reminder 11)10=B)16
Look at the highlighted numbers  5BA0)16

Mantissa will be calculated by using repeated multiplication by 16

0.235*16=3.76 (most significant digit)
0.76*16=12.16)10=C.12)16
0.16*16=2.56. (least significant digit)

0.235)10=0.3C2)16
Answer 23456.235)10= 5BA0.3C2)16


Example#03:1359.79)10= ?)16

For integer use repeated division by 16
1359/16 =84         remainder 15)10=F)16
84/16= 5                remainder 4

1359)10=54F)16
 For mantissa use repeated multiplication by 16
0.79*16=12.64 = C.64)16
0.64*16=10.24 = A.24)16
0.79)16=0.CA)16
Answer 1359.79)10= 54F.CA)16


Hexadecimal to Decimal Conversion:
As we know when converting from any number system to decimal number system we use sum of weights method. Like for binary numbers the sum of weights are powers of 2. For octal numbers the sum of weights are power of 8. Similarly for hexadecimal numbers the sum of weights are powers of 16.

Example#01: 12FB)16= ?)10
12FB)16=(1*163)+(2*162)+(F*161)+(B*160)
            =(1*4096)+(2*256)+(15*16)+(11*1)
            =4096+512+240+11
            =4859)10
Answer 12FB)16= 4859)10


Example#02: 5BA0.3C2)16= ?)10

5BA0.3C2)16=(5*163)+(B*162)+(A*161)+(0*160)
                        .(3*16-1)+(C*16-2)+(2*16-3)
                      =(5*4096)+(11*256)+(10*16)+(0*1)
                       .(3*0.0625)+(12*0.00390625) 
                         neglect 16-3 which is too small.
                       =20480+5632+160.+0.1875+
                        0.046875
                       =23455.23)10
Answer 5BA0.3C2)16= 4859)10


Example#03:  54F.CA)16= ?)10

54F.CA)16= (5*162)+(4*161)+(F*160).(C*16-1)+
                    (A*16-2)
               =(5*256)+(4*16)+(15*1).+(12*0.625)+
                  .(10*0.0039)
                =1280+64+15.75+0.039
                =1359.79)10
Answer 54F.CA)16= 1359.79)10

Octal Numbers to Decimal Numbers Solved Examples

Octal Numbers to Decimal Numbers Conversion and Decimal Numbers to Octal Numbers Conversion
Before beginning to this topic if you want to learn some basic information about number system you can read it from number system detailed explanation. Again I tried to make this topic easy to understand.

Key Questions:
  • Convert from octal number system to decimal number system
  • Convert from decimal number system to octal number system
  • How to convert decimal fraction into octal fraction
  • How to convert octal fraction into decimal fraction

Decimal to Octal Conversion:
The method of converting decimal number to octal number is same as decimal to binary numbers conversion. The difference is that when converting from decimal to binary we use repeated division by 2. But when converting from decimal to octal we use repeated division by 8. For mantissa calculation we use repeated multiplication by 2 when converting a decimal fraction into binary fraction. The method is explained in decimal to binary conversion. Similarly when working with octal numbers we use repeated multiplication by 8 for mantissa calculation.

Example#01:1899)10=?)8
Repeated division by 8
1899/8 = 237       remainder 3
237/8  = 29          remainder 5
29/8 = 3              remainder 5
Answer 1899)10= 3553)8


Example#02:9876.87)10=?)8
First solve integer part by Repeated division by 8
9876/8 = 1234     remainder 4
1234/8  = 154      remainder 2
154/8 = 19           remainder 2
19/2 = 2               remainder 3
9876)10=23224)8

For mantissa calculation use repeated multiplication by 8 method

0.87*8=6.96 (Most significant digit)
0.96*8=7.68
0.68*8=5.44
0.44*8=3.52 (least significant digit)
Answer  9876.87)10= 23224.6752)8


Example#03: 9248.356)10 = ?)8
Repeated division by 8
9248/8 = 1156    remainder 0
1156/8  = 144      remainder 4
144/8 = 18           remainder 0
18/2 = 2               remainder 2

9248)10=22040)8

For mantissa calculation use repeated multiplication by 8.

0.356*8=2.848 (most significant digit)
0.848*8=6.784
0.784*8=6.272 (least significant digit)
0.356)10=0.266)8
Answer: 9248.356)10 = 22040.266)8

Octal to Decimal Conversation:
When we are converting a number from octal number system to decimal number system we use sum of weights method. The method is same as binary to decimal conversion but the difference is base. For binary numbers system we multiply each digit by power of base 2. That is 2n. You can learn binary to decimal conversion here. Similarly when working on octal number system we use power of base 8. That is 8n. At this point I would like to add a table for calculated values of sum of weights. So it's easy to add a table for quick reference.

84
83
82
81
80
8-1
8-2
8-3
8-4
4096
512
64
8
1
0.125
0.015625
0.001953125
0.000244140625


Example#01:3553)8=?)10
5554)8=(3*83)+(5*82)+(5*81)+(3*80)
          =(5*512)+(5*64)+(5*8)+(3*1)
          =1536+320+40+3
          =1899)10
Answer:  3553)8=1899)10


Example#02: 23224.6752)8=?)10
23224.6752)8=(2*84)+(3*83)+(2*82)+(2*81)+(4*80).(6*8-1)+(7*8-2)+(5*8-3)+(2*8-4)
                      =(2*4096)+(3*512)+(2*64)+(2*8)(4*1).(6*0.125)+(7*0.015625).....Neglect small fractions
                     =8192+1536+128+16+4.0.75+0.109375
                     =9876.86)10
Answer:  23224.6752)8=9876.86)10


Example#03: 22040.266)8 =?)10

22040.266)8=(2*84)+(2*83)+(0*82)+(4*81)+(0*80)+(2*8-1)+(6*8-2)+(6*8-3)
                  =(2*4096)+(2*512)+(0*64)+(4*8)+(0*1).(2*0.125)+(6*0.015625)+(6*0.001953125)
                 =8191+1024+0+32+0.+0.25+0.09375+ 0.012
                =9248.36)10
Answer:  22040.266)8=9248.36)10

Popular Posts