Binary to Hexadecimal Formula
A hexadecimal number system is a system of numbers that has a base of 16 and uses numbers from 0 to 7 and alphabets from A to F, where the alphabets from A to F represent the numbers 10 to 15 of the decimal number system. Some examples of the hexadecimal number system are AF16, 7BF, B2A1, etc. We have two types of methods to convert a binary number into a hexadecimal number, i.e., by converting binary to hexadecimal directly, and the other one is converting binary to decimal, and then converting the obtained decimal into hexadecimal.
Decimal number |
Binary number |
Hexadecimal Number |
Decimal number |
Binary number |
Hexadecimal number |
---|---|---|---|---|---|
0 |
0000 |
0 |
8 |
1000 |
8 |
1 |
0001 |
1 |
9 |
1001 |
9 |
2 |
0010 |
2 |
10 |
1010 |
A |
3 |
0011 |
3 |
11 |
1011 |
B |
4 |
0100 |
4 |
12 |
1100 |
C |
5 |
0101 |
5 |
13 |
1101 |
D |
6 |
0110 |
6 |
14 |
1110 |
E |
7 |
0111 |
7 |
15 |
1111 |
F |
For example, convert (1101010)2 to hexadecimal.
Solution:
Method 1:
Step 1: Starting at the right end, divide the given binary number into a pair of four digits.
1101010 ⇒ 110-1010
Step 2: We can notice that the first group doesn’t have four digits. So add zeros on the left. Now, substitute the value of the hexadecimal number into it.
110-1010 ⇒ 0110-1010
(0110)2 = (6)16
(1010)2 = (A)16
Step 3: Now, combine all digits.
0110-1010 = 6 – A = (6A)16
Thus, the binary number (1101010)2 in the hexadecimal system is 6A.
Method 2:
It is a long process as we have to perform two conversions, i.e., from binary to decimal and again from decimal to hexadecimal.
Step 1: Converting the binary number (1101010)2 to decimal
(1 × 26) + (1 × 25) + (0 × 24) + (1 × 23) + (0 × 22) + (1 × 21) + (0 × 20)
= 64 + 32 + 0 + 8 + 0 + 2 + 0 = (106)10
Step 2: Now, divide the obtained decimal number by 16.
We know that in the hexadecimal system 10 is equal to A. Thus, the hexadecimal number is 6A.
Therefore, the binary number (1101010)2 in the hexadecimal system is 6A.
Binary Formula
Binary formulas are formulas that are used to convert binary numbers to other number systems. A binary number system is a system of numbers that has a base of 2 and uses only two digits, “0 and 1”. It is one of the four types of number systems and is most commonly employed by computer languages like Java and C++. “Bi” in the word “binary” stands for “two.” Some examples of binary numbers are (11)2, (1110)2, (10101)2, and so on.
In this article, we discuss the arithmetic operations of binary numbers and the conversion formulae to convert binary numbers into other three-number systems.
Table of Content
- Binary Formula
- Arithmetic Operation on Binary Numbers
- Binary to Decimal Formula
- Decimal to Binary Formula
- Binary to Octal Formula
- Binary to Hexadecimal Formula
Contact Us