Table of Contents
Last modified on February 7th, 2024
The term ‘hexa’ means 6 and ‘deci’ means 10. Together, ‘hexadecimal’ means 16.
The hexadecimal number system (hex) is a type of number system that uses 16 characters to represent numbers of values. It includes digits 0 to 9 and alphabets A to F. Thus, it has a base of 16. It is represented as (23E)16.
It is also known as the positional number system, as each digit has a power of 16. Here, the value of each digit is 16 times more significant than the previous one. Thus, we can easily convert any hexadecimal number to any other number system by multiplying each digit based on its position in the number.
The table shows the binary and decimal equivalents of the 16 hexadecimal elements making up the hexadecimal number system.
Hexadecimal Number | Decimal Number | Binary Number |
---|---|---|
0 | 0 | 0 |
1 | 1 | 1 |
2 | 2 | 10 |
3 | 3 | 11 |
4 | 4 | 100 |
5 | 5 | 101 |
6 | 6 | 110 |
7 | 7 | 111 |
8 | 8 | 1000 |
9 | 9 | 1001 |
A | 10 | 1010 |
B | 11 | 1011 |
C | 12 | 1100 |
D | 13 | 1101 |
E | 14 | 1110 |
F | 15 | 1111 |
The advantage of using hexadecimal numbers is that it takes less memory to store more numbers.
A hexadecimal number is converted to binary, octal, and decimal using the base 16. To convert from hexadecimal form, we use the sum of the product of each digit with its value based on its position. It is done by multiplying each digit from the left as 160, 161, 162, 163 and from the right as 16-1, 16-2, 16-3.
Using Table
The hexadecimal number is first converted to the corresponding decimal number and then to the binary number using the table above.
Now, let us convert (52F)16 to binary.
The decimal equivalent to (52F)16 is
(5)16 → (5)10
(2)16 → (2)10
Using the table, we get the binary equivalents of the decimal digits
(5)10 → (101)2
(2)10 → (10)2
Combining all the binary numbers, we get (101101111)2
Without Using Table
It requires both multiplication and division of numbers using the respective base numbers. To obtain the decimal number, we multiply each digit with 16n-1 when it is in its nth position. We further divide the decimal number by 2 and the quotient in the successive steps until we get zero. Finally, we obtain the binary number by arranging the remainder from bottom to top.
The decimal equivalent to (52)16 is
(52)16 = 5 × 16(2-1) + 2 × 16(1-1)
= 5 × 161 + 2 × 160
= 80 + 2
= 82
Thus, the decimal equivalent to (52)16 is (82)10
Now, converting it to the binary equivalent, we get
Dividend | Quotient | Remainder |
---|---|---|
82 ÷ 2 | 41 | 0 |
41 ÷ 2 | 20 | 1 |
20 ÷ 2 | 10 | 0 |
10 ÷ 2 | 5 | 0 |
5 ÷ 2 | 2 | 1 |
2 ÷ 2 | 1 | 0 |
1 ÷ 2 | 0 | 1 |
Thus, the binary equivalent to (82)10 is (1010010)2
For converting a hexadecimal number to an octal number, we first convert it to a decimal number and then to an octal number.
Let us convert (BF5)16 to octal.
Converting (BF5)16 to decimal number
(BF5)16 = B × 162 + F × 161 + 5 × 160
As B → 11, F →15
B × 162 + F × 161 + 5 × 160
= 11 × 162 + 15 × 161 + 5 × 160
= 2,816 + 240 + 5
= 3,061
Thus, (BF5)16 → (3,061)10
Now, we convert (3,061)10 to octal by dividing the number by 2 until the quotient is 0.
Dividend | Quotient | Remainder |
---|---|---|
3,061 ÷ 2 | 1530 | 1 |
1530 ÷ 2 | 765 | 0 |
765 ÷ 2 | 382 | 1 |
382 ÷ 2 | 191 | 0 |
191 ÷ 2 | 95 | 1 |
95 ÷ 2 | 47 | 1 |
47 ÷ 2 | 23 | 1 |
23 ÷ 2 | 11 | 1 |
11 ÷ 2 | 5 | 1 |
5 ÷ 2 | 2 | 1 |
2 ÷ 2 | 1 | 0 |
1 ÷ 2 | 0 | 1 |
Thus, the binary equivalent to (3,061)10 is (101111110101)2
Converting a hexadecimal number to decimal is the first step of converting hexadecimal to octal form, as we have done above.
The above table is used to convert binary, decimal, and octal numbers to hexadecimal numbers.
Let us convert (11001111011)2 to hexadecimal.
Using the table, we get
0110 → 6
0111 → 7
1011 → B
Thus, the hexadecimal equivalent of (11001111011)2 is (67B)16
To convert from octal to hexadecimal, we first convert the octal number to a binary number and then to a hexadecimal number.
To convert the octal number to a binary number, we use the following table:
Octal | Binary |
---|---|
0 | 0 |
1 | 1 |
2 | 010 |
3 | 011 |
4 | 100 |
5 | 101 |
6 | 110 |
7 | 111 |
Let us consider an example by converting (245)8 to hexadecimal
Here, (245)8 is first converted to binary.
2 → 10
4 → 100
5 → 101
Hence,
(245)8 = (10100101)2
Now, using the binary to hexadecimal conversion table, we get,
1010 → A
0101 → 5
Thus,
(10100101)2 → (A5)16
Thus, the hexadecimal equivalent of (245)8 is (A5)16
To convert from decimal to hexadecimal form, we divide the number repeatedly by 16 until the quotient is 0.
Let us convert (120)10 to hexadecimal.
Dividend | Quotient | Remainder |
---|---|---|
120 ÷ 16 | 7 | 8 |
7 ÷ 16 | 0 | 7 |
Thus,
(120)10 → (78)16Therefore, the decimal equivalent of (120)10 is (78)16
Last modified on February 7th, 2024