# Conversion of Hexadecimal Number System to Binary, Octal and Decimal Number Systems

Here, we are going to learn how to convert Hexadecimal Number System to Binary, Octal and Decimal Number Systems?
Submitted by Saurabh Gupta, on October 19, 2019

### 1) Conversion of Hexadecimal Number System to Binary Number System

To convert hexadecimal numbers into binary numbers, we can use the relationship between hexadecimal and binary numbers.

000000
110001
220010
330011
440100
550101
660110
770111
881000
991001
10A1010
11B1011
12C1100
13D1101
14E1110
15F1111

Example 1: Convert (7A.2C)16 into ( ? )2

Solution:

Using the table provided above, we can replace hexadecimal numbers with their equivalent binary digits.

Therefore, (7A.2C)16 = (0111 1010.0010 1100)2

Example 2: Convert (D2A.2B7)16 into ( ? )2

Solution:

Using the table provided above, we can replace hexadecimal numbers with their equivalent binary digits.

Therefore, (D2A.2B7)16 = (1101 0010 1010.0010 1011 0111)2

Example 3: Convert (FF18.5E5)16 into ( ? )2

Solution:

Using the table provided above, we can replace hexadecimal numbers with their equivalent binary digits.

Therefore, (FF18.5E5)16 = (1111 1111 0001 1000. 0101 1110 0101)2

### 2) Conversion of Hexadecimal Number System into Octal Number System

Conversion of the hexadecimal number to octal number can be done using a certain definite path. We first have to convert hexadecimal numbers to a binary number and then convert a binary number into octal number i.e., Hexadecimal Number → Binary Number → Octal Number

Example 1: Convert (1D.E)16 into ( ? )8

Solution:

Step 1: Converting the first hexadecimal number into a binary number. Thus, (1D.E)16 = (0001 1101.1110)2

Step 2: Now, converting the binary number into an octal number which gives (00011101.1110)2 = (35.7)8

Therefore, (1D. E)16 = (35.7)8

Note: To know how to convert binary number into octal number? Read: conversion of Binary number system to octal number system.

Example 2: Convert (3B.4)16 into ( ? )8

Solution:

Step 1: Converting the first hexadecimal number into a binary number. Thus, (3B.4)16 = (0011 1011.0100)2

Step 2: Now, converting the binary number into an octal number which gives (0011 1011.0100)2 = (73.20)8

Therefore, (3B.4)16 = (73.20)8

### 3) Conversion of Hexadecimal Number System to Decimal Number System

Conversion of hexadecimal number into a decimal number can be done using the positional weights by multiplying the positional weights with the corresponding bit and add them all together to obtain the decimal number.

In an integral part of the hexadecimal number, the weights follow the pattern as 160, 161, 162, 163, 164, 165 and so on from right to left.

In the fractional part of the hexadecimal number, the weights follow the pattern as 16-1, 16-2, 16-3, 16-4, 16-5 and so on from left to right.

Only thing to be kept in mind is A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.

Example 1: Convert (75.3)16 into ( ? )10

Solution:

```    (75.3)16    = 7 * 161 + 5 * 160 + 3 * 16-1
= 112 + 5 + 0.1875 = (117.1875)10
```

We multiply each bit with the corresponding positional weight and then add them together to get the result.

Therefore, (75.3)16 = (117.1875)10

Example 2: Convert (CD3.B70A)16 into ( ? )10

Solution:

```    (CD3.B70A)16    = C*162 + D*161 + 3*160 + B*16-1 + 7*16-2 + 0*16-3 + A*16-4
= 12*256 + 13*16 + 3*1 + 11/16 + 7/256 + 0 + 10/65536
= 3072+ 208 + 3 + 0.6875 + 0.0273 + 0.0001
= (3283.7149)10
```

We multiply each bit with the corresponding positional weight and then add them together to get the result.

Therefore, (CD3.B70A)16 = (3283.7149)10

TOP Interview Coding Problems/Challenges

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates