How to convert Binary to Hexadecimal?
Last Updated :
18 Feb, 2024
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 = 23 × 1 + 22 × 1 + 21 × 1 + 20 × 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*20 = (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 hexadecimal
0.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 0100 |
E 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 = 0001 1111 1101 (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 = 0010 1111 0001 (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 . 1100 1000 (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).
= 0 C 8
(0.11001)2 = (0.C8)16
Question 4: Convert: (1.1)2 = (_______)16
Solution:
(1.1)2 = 0001 . 1000 (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).
= 1 8
= (1.1)2 = (1.8)16
Question 5: Convert: (101.10101)2 = (_______)16
Solution:
(101.10101)2 = 0101 . 1010 1000 (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)
= 5 A 8
= (101.10101)2 = (5A8)16
Question 6: Convert: (100001.00000001)2 = (_______)16
Solution:
(100001.00000001)2 = 0010 0001.0000 0001 (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 = 1011 1101 . 0001 1110 (The bold one 0 is added after 111 as 111 is after the radix point)
= B D 1 E
= (10111101.0001111)2 = (BD.1E)16
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...