In order to avoid the writing of long strings of 1’s and 0’s, other number systems based on powers of 2 are used, the most common being the base 16 or hexadecimal number system.

The base-16 hexadecimal number system has 16 digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F).

Note that the single hexadecimal symbol A is equivalent to the decimal number 10, the single symbol B is equivalent to the decimal number 11, and so forth, with the symbol F being equivalent to the decimal number 15.

we again write a number as a string of symbols, but now each symbol is one of the 16 possible hexadecimal digits (0 through F). To interpret a hexadecimal number, we multiply each digit by the power of 16 associated with that digit’s position

In hexadecimal, we need six more symbols to take us beyond 0 to 9. These are
A := 10, B := 11, C := 12, D := 13, E := 14, F := 15.

For example, consider the hexadecimal number 1A9B. Indicating the values associated with the positions of the symbols, this number is illustrated as

## Converting a Hexadecimal Number to a Decimal Number

To convert a hexadecimal number to a decimal number, write the hexadecimal number as a sum of powers of 16

For Example : 1

2A6B =2(163) +A(162)+6(161)+B(160)=2(4096)+10(256)+6(16)+11(1)=10859

Example 2

25C.64= 2*162 + 5*161 + 12*160 + 6*16-1 + 4*16-2

= 2*256 + 5*16 + 12 + 6/16 + 4/256

= 512 + 80 + 12 + 0.375 + 0.015625 = 604.390625

## Converting a Decimal Number to a Hexadecimal Number

Convert from decimal to hexadecimal is to use the same division algorithm that you used to convert from decimal to binary, but repeatedly dividing by 16 instead of by 2.We keep track of the remainders, and the sequence of remainders forms the hexadecimal representation

For example, to convert the decimal number 746 to hexadecimal, we proceed as follows

So, the decimal number 746 = 2EA in hexadecimal

## Converting a Hexadecimal Number to a Binary Number

We can convert hexadecimal notation to the equivalent binary representation by using the following procedure

• Convert each hexadecimal digit to a four-digit binary number
• fit together the resulting four-bit binary numbers

For Example -convert the hexadecimal number 5DA8 to binary

Step 1: 5=0101   D=1101    A= 1010   8=1000

Step 2: Therefore 5DA8= 0101110110101000

## Converting a Binary Number to a Hexadecimal Number

we can convert directly from binary notation to the equivalent hexadecimal representation by using the following procedure

• Starting at the right, collect the bits in groups of 4
• Convert each group of 4 bits into the equivalent hexadecimal digit
• Concatenate the resulting hexadecimal digits

For Example : Convert 110110101001 to hexadecimal

step 1 :Groups of 4 starting at the right

1101 1010 1001

step 2 : Convert each collection of bits into a hexadecimal digit

1101     1010     1001

D           A            9

Therefore           110110101001 = DA9

So, now you should be comfortable going back and forth between binary, decimal and hex representations