Menu

Denary to Hexadecimal Conversion

Checking a Denary to Hexadecimal Conversion

You can always check a denary to hexadecimal conversion by turning the answer back into denary. A two-digit hex number has place values of 16 and 1, so multiply the left digit by 16, add the right digit, and see whether the result matches the number you started with.

For example, if your answer for 173 is AD, change A back to 10, work out 10 × 16 = 160, then add D, which is 13: 160 + 13 = 173. This matches the original, so the conversion is correct.

Three quick checks

  • The answer must be exactly two characters, and every character must be a single hex digit from 0 to F. An answer such as 2F4 cannot be right because it has three characters.
  • Work out the value from the two digits and check it lies between 0 and 255, the range covered by 00 to FF. A value outside that range means a character is not a valid hex digit.
  • The left digit counts 16s, not 10s. In 4A the 4 is worth 4 × 16 = 64, and the A is worth 10, giving 74 — not 410 by joining the digits, and not 50 by using denary place values.

Letters must be changed to 10 to 15 before you multiply. If you treat A as 1, or forget that it stands for 10, the check will not work. Never read a hex answer as though it were a denary number, and never assume a letter has no fixed value: A always means 10, B always means 11, and so on up to F for 15.

Hex answerWorking backwardsDenary value
5B5 × 16 + 1191
0E0 × 16 + 1414

A leading zero is still a character, so 0E is a valid two-digit answer and checks correctly to 14. Dropping it would break the rule that the answer is always two hex digits.

Practise this

OCR GCSE Computer Science · Denary to Hexadecimal Conversion

OCR GCSE Computer Science · Hexadecimal to Denary Conversion