Converting Decimal to Hexadecimal

Teach any GCSE Computer Science class

We have put together a full GCSE Computer Science curriculum that will give you all the teaching materials you need to teach any topic.

Whether you’re a brand new Computer Science teacher, or you’ve been teaching ICT for years, our resources will save you hours and hours of lesson preparation every single week.

View the resources →

Decimal Numbering System

Decimal is a base 10 numbering system which is made up of 10 numbers: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.  It is the most commonly used numbering system.  The reason behind that is convenience.  We have 10 fingers that we use for counting, so it is easier to count with a base 10 numbering system, thus decimal is widely used.

Hexadecimal Numbering System

Hexadecimal is a base 16 numbering system which is made up of 16 digits: 0 – 9 and six more, which is A through F.

Conversion from Decimal to Hexadecimal

Conversion can be done by dividing the decimal number by 16 repeatedly until the final result is 0.
For example, the decimal number 357 is converted to hexadecimal number as follows:

Division Result Remainder
357 / 16 22 5
22 / 16 1 6
1 / 16 0 1

Hexadecimal number is taken from the remainder starting from the last to the first, or in the illustration above, from bottom to top, which is 165.
Note: For remainder between 0 to 9, hexadecimal equivalent is the same, see table below.

Hexadecimal Decimal
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9

So decimal number 357 is 165 in hexadecimal number.
35710 = 16516
Another example, with remainder greater than 9, in order to have an alphabet result.
Decimal number 2856 is converted to hexadecimal number as follows:

Division Result Remainder
2856 / 16 178 8
178 / 16 11 2
  11 / 16 0 11

Hexadecimal number is taken from the remainder starting from the last to the first, or in the illustration above, from bottom to top, which is 1128.  Looking at the table below, 11 is B in hexadecimal.

Hexadecimal Decimal
A 10
B 11
C 12
D 13
E 14
F 15

So decimal number 2856 is B28 in hexadecimal number.
285610 = B2816

Conversion from Hexadecimal to Decimal

Conversion can be done by multiplying the hexadecimal number by 16.  Each digit will be multiplied by the corresponding power of 16 value.  It would be easier to convert by putting the hexadecimal on the power of 16 columns as follows:

Exponent 162 161 160
Value 256 16 1
Hexadecimal 1 6 5

Multiply each value by the hexadecimal digit as follows:
(1 x 256) = 256
(6 x 16) = 96
(5 x 1) = 5
Total value = (256 + 96 + 5) = 357
So, the hexadecimal number 165 is 357 in decimal number.
16516 = 35710
Another example, with alphabet hexadecimal digit.
Conversion can be done by multiplying the hexadecimal number by 16.  Each digit will be multiplied by the corresponding power of 16 value.  It would be easier to convert by putting the hexadecimal on the power of 16 columns as follows:

Exponent 162 161 160
Value 256 16 1
Hexadecimal B 2 8

Multiply each value by the hexadecimal digit as follows:
(B x 256) = (11 x 256) = 2,816
(2 x 16) = 32
(8 x 1) = 8
Total value = (2,816 + 32 + 8) = 2,856
So, the hexadecimal number B28 is 2,856 in decimal number.
B2816 = 2,85610
Conversion may seem difficult at first, but with just a little practice and understanding the principles behind the conversion, it would be easier over time.  Of course, there are online conversion tools and calculators, but it would be handy to know how it is done manually and understand the concept behind the different numbering systems.