So, hey guys today we are going to learn “How to convert a binary number into a hexadecimal number”.
Before starting this blog let’s take a recap about what are binary decimal and a hexadecimal numbers. So, let’s started…
Binary Number
Binary numbers are those number who uses only two-digit of a number system 0(Zero) and 1(One) and their base is “2”. Example is 101, 010, 1001, 01100111, etc. These types of numbers are known as Binary Numbers.
Hexadecimal Number
A Hexadecimal Number is a number that uses 16-digits of a number system. In which the range of a hexadecimal number between 0 to 9 (0,1,2,3,4,5,6,7,8,9) and A to F (A,B,C,D,E,F). A to F is equivalent to the number 10 to 16 (10, 11, 12, 13, 14, 15, and last 16). This number system is known as Hexa-Decimal Number. Example: 9, 12, 27, 2BC, 9DF, 6EA, 5AFE etc.,
To get about more details about this topic go to this link “Computer Number System”
For better understanding let start directly with the example…
Example 1: Convert a binary number (101)2 into a Hexadecimal number?
Sol:
Step 1: Firstly we have to convert the given number into a decimal number. Let’s convert it…
= (101)2 = 1x22 + 0x21 + 1x20 = 1x4 + 0x2 + 1x1 = 4 + 0 + 1 = 5 Hence, the decimal value is (5)10
Step 2: Now, we have to divide the given number by 16 until the quotients come to 0.
Decimal No. ÷ by 16 | Quotient | Remainder | Remainder in hexadecimal |
---|---|---|---|
5 ÷ 16 | 0 | 5 | 5 |
Hence, our final answer is (5)16.
Example 2: Convert the binary number (10110)2 into a Hexadecimal number?
Sol:
Step 1: Firstly we have to convert the given number into a decimal number. Let’s convert it…
= (10110)2 = 1x24 + 0x23 + 1x22 + 1x21 + 0x20 = 1x16 + 0x8 + 1x4 + 1x2 + 0x1 = 16 + 0 + 4 + 2 + 0 = 22 Hence, the decimal value is (22)10
Step 2: Now, we have to divide the given number by 16 until the quotients come to 0.
Decimal No. ÷ by 16 | Quotient | Remainder | Remainder in hexadecimal |
---|---|---|---|
22 ÷ 16 | 1 | 6 | 6 |
1÷ 16 | 0 | 1 | 1 |
Now, write all the remainder from downward to the upward manner like this = 16
Hence, our final answer is (16)16.
Example 3: Convert the binary number (11101101)2 into a Hexadecimal number?
Sol:
Step 1: Firstly we have to convert the given number into a decimal number. Let’s convert it…
= (11101101)2 = 1x27 + 1x26 + 1x25 + 0x24 + 1x23 + 1x22 + 0x21 + 1x20 = 1x128 + 1x64 + 1x32 + 0x16 + 1x8 + 1x4 + 0x2 + 1x1 = 128 + 64 + 32 + 0 + 8 + 4 + 0 + 1 = 237 Hence, the decimal value is (237)10
Step 2: Now, we have to divide the given number by 16 until the quotients come to 0.
Decimal No. ÷ by 16 | Quotient | Remainder | Remainder in hexadecimal |
---|---|---|---|
237 ÷ 16 | 14 | 13 | D |
14 ÷ 16 | 0 | 14 | E |
Now, write the hexadecimal remainder from downward to the upward manner like this = ED
Hence, our final answer is (ED)16.
Example 4: Convert the binary number (1011001111)2 into a Hexadecimal number?
Sol:
Step 1: Firstly we have to convert the given number into a decimal number. Let’s convert it…
= (1011001111)2 = 1x29 + 0x28 + 1x27 + 1x26 + 0x25 + 0x24 + 1x23 + 1x22 +1x21 + 1x20 = 1x512 + 0x256 + 1x128 + 1x64 + 0x32 + 0x16 + 1x8 + 1x4 + 1x2 + 1x1 = 512 + 0 + 128 + 64 + 0 + 0 + 8 + 4 + 2 + 1 = 719 Hence, the decimal value is (719)10
Step 2: Now, we have to divide the given number by 16 until the quotients come to 0.
Decimal No. ÷ by 16 | Quotient | Remainder | Remainder in hexadecimal |
---|---|---|---|
719 ÷ 16 | 44 | 15 | F |
44 ÷ 16 | 2 | 12 | C |
2 ÷ 16 | 0 | 2 | 2 |
Now, write the hexadecimal remainder from downward to the upward manner like this = 2CF
Hence, our final answer is (2CF)16.
Example 5: Convert the binary number (10000000001)2 into Hexadecimal number?
Sol:
Step 1: Firstly we have to convert the given number into a decimal number. Let’s convert it…
= (1000000001)2 = 1x210 + 0x29 + 0x28 + 0x27 + 0x26 + 0x25 + 0x24 + 0x23 +0x22 + 0x21 + 1x20 = 1x1024 + 0x512 + 1x256 + 1x128 + 0x64 + 0x32 + 1x16 + 1x8 + 1x4 + 1x2 + 1x1 = 1024 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 = 1025 Hence, the decimal value is (1025)10
Step 2: Now, we have to divide the given number by 16 until the quotients come to 0.
Decimal No. ÷ by 16 | Quotient | Remainder | Remainder in hexadecimal |
---|---|---|---|
1025 ÷ 16 | 64 | 1 | 1 |
64 ÷ 16 | 4 | 0 | 0 |
4 ÷ 16 | 0 | 4 | 4 |
Now, write the hexadecimal remainder from downward to the upward manner like this = 401
Hence, our final answer is (401)16.
Example 6: Convert the binary number (11110000)2 into a Hexadecimal number?
Sol:
Step 1: Firstly we have to convert the given number into a decimal number. Let’s convert it…
= (11110000)2 = 1x27 + 1x26 + 1x25 + 0x24 + 0x23 + 0x22 + 0x21 + 0x20 = 1x128 + 1x64 + 1x32 + 1x16 + 0x8 + 0x4 + 0x2 + 0x1 = 128 + 64 + 32 + 16 + 0 + 0 + 0 + 0 = 240 Hence, the decimal value is (240)10
Step 2: Now, we have to divide the given number by 16 until the quotients come to 0.
Decimal No. ÷ by 16 | Quotient | Remainder | Remainder in hexadecimal |
---|---|---|---|
240 ÷ 16 | 15 | 0 | 0 |
15 ÷ 16 | 0 | 15 | F |
Now, write the hexadecimal remainder from a downward to an upward manner like this = F0
Hence, our final answer is (F0)16.