# How to convert Binary to Hexadecimal?

Number Systems are a major part of mathematics. The number system and its conversions are used in the various fields of mathematics and computer science. This article is about the binary, hexadecimal, and conversion of binary to the hexadecimal number system. The binary to decimal conversion is very easy and is explained further. The binary number system is a system in which numbers are expressed in the base 2. In the binary number system, the numbers are represented in terms of 0s and 1s only. The digits in the binary number system are called bits or binary digits. Example: (10110)_{2},

Decimal | Binary |
---|---|

0 | 0000 |

1 | 0001 |

2 | 0010 |

3 | 0011 |

4 | 0100 |

5 | 0101 |

6 | 0110 |

7 | 0111 |

8 | 1000 |

9 | 1001 |

10 | 1010 |

11 | 1011 |

12 | 1100 |

13 | 1101 |

14 | 1110 |

15 | 1111 |

The hexadecimal number system is a system in which numbers are expressed in the base 16. In the hexadecimal number system, the numbers are represented in terms of 0-9 and A – F. The hexadecimal number is written as number H, (number)_{16}, (number)_{H}. Example: (A23F)_{16},

Decimal | Hexadecimal |
---|---|

0 | 0 |

1 | 1 |

2 | 2 |

3 | 3 |

4 | 4 |

5 | 5 |

6 | 6 |

7 | 7 |

8 | 8 |

9 | 9 |

10 | A |

11 | B |

12 | C |

13 | D |

14 | E |

15 | F |

### Conversion of Binary to Hexadecimal

**Method 1**

- Firstly, convert the given binary number into decimal.
- Then, convert the obtained decimal into hexadecimal.

**Example: (1110) _{2} = (_______)_{16}**

First convert (1110)

_{2}into decimal = (1110)_{2}= 2^{3 }× 1 + 2^{2 }× 1 + 2^{1 }× 1 + 2^{0 }× 0 = 8 + 4 + 2 + 0 = (14)_{10}Then, convert (14)

_{10}into hexadecimal = (14)_{10}= (E)_{16}

**Example 2 : (0.11001) _{2} = (_________)_{16}**

First convert (0)

_{2}to decimal = 0*2^{0}= (0)_{10}Then convert (11001)

_{2 }to decimal = 1*2^{-1}+ 1*2^{-2 }+ 0*2^{-3 }+ 0*2^{-4 }+ 1*2^{-5 }= (0.78125)_{10}Now, convert (0)

_{10}into hexadecimal = (0)_{16}Now convert (.78125)

_{10 }to hexadecimal0.78125*16 = 12.5

0.5*16 = 8.0

(.78125)

_{10}to hexadecimal = (.C8)_{16}where C for 12 and 8 for 8

So (0.11001)

_{2 }= (0.C8)_{16}

**Method 2: (Direct Method for converting binary to hexadecimal) **

Take the given binary number and form the collection of four bits called a quad, then replace the quad with its hexadecimal equivalent. Hence, the obtained number is the conversion of a given binary to hexadecimal.

**Note**

- If, while forming the quad, the bits are before the radix point, then start forming the quad from the LSB bit and if the bits are after the radix point, start forming the quad from the immediate bit after the radix point.
- While forming the quad, the number of bits is less than 4 and before the radix point, then add 0s before the fewer bits to form a quad.
- While forming the quad, the number of bits is less than 4 and after the radix point then, add 0s after the fewer bits to form a quad.

Decimal | Binary | Hexadecimal |
---|---|---|

0 | 0000 | 0 |

1 | 0001 | 1 |

2 | 0010 | 2 |

3 | 0011 | 3 |

4 | 0100 | 4 |

5 | 0101 | 5 |

6 | 0110 | 6 |

7 | 0111 | 7 |

8 | 1000 | 8 |

9 | 1001 | 9 |

10 | 1010 | A |

11 | 1011 | B |

12 | 1100 | C |

13 | 1101 | D |

14 | 1110 | E |

15 | 1111 | F |

**Example: (11101111.111001) _{2} = (_______)_{16}**

1110 1111.1110 01 1110 1111 1110 01 00E F E 4 (11101111.111001) _{2 }= (EF.E4)_{16}

We added two zeros at the last as we have only 01, which does not make a quad. 0s are added after 01 because it is after the radix point.

### Sample Questions

**Question 1: Convert: (111111101) _{2} = (_________)_{16}**

**Solution:**

(111111101)

_{2}=000111111101(The bold three 0s are added before 1 as it is integral part (before the radix point))= 1 F D

= (111111101)_{2 }= (1FD)_{16}

**Question 2: Convert: (01011110001) _{2} = (_________)_{16}**

**Solution:**

(01011110001)

_{2}=001011110001(The bold one 0s are added before 1 as it is integral part (before the radix point))= 2 F 1

= (01011110001)_{2}= (2F1)_{16}

**Question 3: Convert: (0.11001) _{2} = (_________)_{16}**

**Solution:**

(0.11001)

_{2}=0000.11001(The bold three 0s are added before 0 as it is an integral part (before the radix point), and 3 bold 0s are added after 1 as 1 is after the radix point).000= 0 C 8

(0.11001)_{2}= (0.C8)_{16}

**Question 4: Convert: (1.1) _{2} = (_______)_{16}**

**Solution:**

(1.1)

_{2}=0001.1(The bold three 0s are added before 1 as it is an integral part (before the radix point), and 3 bold 0s are added after 1 as 1 is after the radix point).000= 1 8

= (1.1)_{2}= (1.8)_{16}

**Question 5: Convert: (101.10101) _{2} = (_______)_{16}**

**Solution:**

(101.10101)

_{2}=0101.10101(The bold one 0 is added before 101 as it is integral part (before the radix point) and 3 bold 0s are added after 1 as 1 is after the radix point)000= 5 A 8

= (101.10101)_{2 }= (5A8)_{16}

**Question 6: Convert: (100001.00000001) _{2} = (_______)_{16}**

**Solution:**

(100001.00000001)

_{2 }=00100001.00000001(The bold two 0s are added before 10 as it is integral part (before the radix point))= 2 1 0 1

= (100001.00000001)_{2}= (21.01)_{16}

**Question 7: Convert: (10111101.0001111) _{2} = (_______)_{16}**

**Solution: **

(10111101.0001111)

_{2}=10111101.0001111(The bold one 0 is added after 111 as 111 is after the radix point)0= B D 1 E

= (10111101.0001111)_{2}= (BD.1E)_{16}