Mr Goff logo

Computer Science

About hexadecimal

Hexadecimal is a base 16 counting system meaning it can represent the numbers from 0 to 15 in each column. For numbers bigger than 9 the letters a to f are used as seen in the table below.

Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F

This page deals with 2 digit hex numbers. With a hex number the digit in the column on the right is the number of 1s in a number with the lowest value being 0 and the highest being F representing 15. The second column therefore represents the numer of 16s in the number.

Column_heading 16s 1s
Value C 4

The value C4 shown above is equal to C x 16 + 4 = 12 x 16 + 4 = 192 + 4 = 196.

Hexadecimal to decimal

Use the area below to generate a random hex number to practice converting numbers from hexadecimal to decimal.

Example

For our example let's convert the hexadecimal number A7 to it's decimal equivalent.

The formula for this is decimal = first hex digit x 16 + second hex digit. To use the formula simply slot in the hex digits and if they are letters convert them to their decimal equivalent e.g. A = 10, B= 11 etc. Then work through the maths to the solution.

So in our example decimal = A x 16 + 7 = 10 x 16 + 7 = 160 + 7 = 167.

Therefore our A7 in hexadecimal is equivalent to 167 in decimal.

Hexadecimal to decimal practice

Click the button to get a number to convert

Enter the decimal equivalent above.



Computer Science Home