How to – Denary to Hexadecimal Conversion

Converting decimal (denary) into hexadecimal is very simple. All we need is to remember that hexadecimal is a base 16 number.  This means that each number column can contain 16 characters.  Hexadecimal goes from 0 to F:

Decimal NumberHexadecimal Number
00
11
22
33
44
55
66
77
88
99
10A
11B
12C
13D
14E
15F

EG

Using the table – 7 in decimal is 7 in hexadecimal.

Using the table – 10 in decimal is A in hexadecimal.


Denary to Hexadecimal Conversion to 2 figures

In GCSE computer science you will be expected to convert denary into 2 figure hexadecimal.  Again we need to remember that hexadecimal is a base 16 number and each number column can go from 0-9 and A-F. 


Example 1

Convert decimal number 162 into hexadecimal

Draw out a 2 column table with 16 on the left and 1 on the right. We now take our original number and divide it by 16

161
162 / 16
= 10 remainder 2

The answer is 10 (16 x 10 = 160) and gives us a remainder of 2. The remainder of 2 is then carried across to the 1 column. The remainder is then divided by 1.

161
162 / 16
= 10
2 / 1
= 2

We now need to check our columns to see if any number needs converting to a hexadecimal character. In the 16 column we have a 10. A 10 in hexadecimal is the letter A so we substitute the 10 for an A.

161
162 / 16
= 10
2 / 1
= 2
10 = A2 = 2
= A= 2

The final step is to put the 2 columns together

162 in denary = A2 in hexadecimal


Example 2

Convert decimal number 40 into hexadecimal

161
40 / 16
= 2 remainder 8
8 / 1
= 8
2 = 28 = 8
= 2= 8

40 in decimal = 28 in hexadecimal