Last modified on February 7th, 2024

chapter outline

 

Hexadecimal Number System

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.

Hexadecimal Number System

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 NumberDecimal NumberBinary Number
000
111
2210
3311
44100
55101
66110
77111
881000
991001
A101010
B111011
C121100
D131101
E141110
F151111

The advantage of using hexadecimal numbers is that it takes less memory to store more numbers.

Conversion of Hexadecimal 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.

Hexadecimal to Binary

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

(F)16 → (15)10

Using the table, we get the binary equivalents of the decimal digits

(5)10 → (101)2

(2)10 → (10)2

(15)16 → (1111)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

DividendQuotientRemainder
82 ÷ 2410
41 ÷ 2201
20 ÷ 2100
10 ÷ 250
5 ÷ 221
2 ÷ 210
1 ÷ 201

Thus, the binary equivalent to (82)10 is (1010010)2

Hexadecimal to Octal

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.

DividendQuotientRemainder
3,061 ÷ 215301
1530 ÷ 27650
765 ÷ 23821
382 ÷ 21910
191 ÷ 2951
95 ÷ 2471
47 ÷ 2231
23 ÷ 2111
11 ÷ 251
5 ÷ 221
2 ÷ 210
1 ÷ 201

Thus, the binary equivalent to (3,061)10 is (101111110101)2

Hexadecimal to Decimal

Converting a hexadecimal number to decimal is the first step of converting hexadecimal to octal form, as we have done above.

Conversion to Hexadecimal Numbers

The above table is used to convert binary, decimal, and octal numbers to hexadecimal numbers.

Binary to Hexadecimal

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

Octal to Hexadecimal

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:

OctalBinary
00
11
2010
3011
4100
5101
6110
7111

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

Decimal to Hexadecimal

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.

DividendQuotientRemainder
120 ÷ 1678
7 ÷ 1607

Thus,

(120)10 → (78)16Therefore, the decimal equivalent of (120)10 is (78)16

Last modified on February 7th, 2024