Converting Between Hexadecimal & Denary
Converting Denary to Hexadecimal Walkthrough:
- Divide the decimal number (in this example 57) by 16 and write down the answer including the remainder:
57 ÷ 16 = 3 remainder 9 - If the remainder is above 9, replace this with the corresponding letter
- Repeat steps 1 and 2 until the number you’re dividing is zero:
3 ÷ 16 = 0 remainder 3 - Write the hexadecimal values from step 3 to step 1 in reverse order:
39
Alternatively, you can turn your denary number into binary, and then turn the binary number into hexadecimal:
1. Work out 57 in binary
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 |
2. Split it into 2 nibbles
8 | 4 | 2 | 1 | 8 | 4 | 2 | 1 | |
0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 |
3. Turn each nibble into its hex value
2+1=3 8+1=9
Answer is 39
Converting Hexadecimal to Denary Walkthrough:
- Write down the place value of each digit in the number, starting from the right and increasing by a power of 16:
161
160
16
1
- If the hex digit is a letter, convert it to its denary equivalent (Using the following table to help you):
|
|
A |
10 |
B |
11 |
C |
12 |
D |
13 |
E |
14 |
F |
15 |
- The hexadecimal value of the leftmost digit E has a decimal value of 14. The hexadecimal value of the rightmost digit is 5, which has a decimal value of 5
16
1
E
5
- Multiply each decimal value by its corresponding place value, and sum the products:
(14 x 16) + (5 x 1) = 224 + 5 = 229
Therefore, the denary equivalent of E5 is 229.
Alternatively, you can turn your hexadecimal number into binary, and then turn the binary number into denary:
1. Write each hex digit in binary
8 | 4 | 2 | 1 | 8 | 4 | 2 | 1 | |
1 | 1 | 1 | 0 | 0 | 1 | 0 | 1 |
2. Convert the binary to denary
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
1 | 1 | 1 | 0 | 0 | 1 | 0 | 1 |
128+64+32+4+1=229
Exam Tip
- When doing conversions don’t remove any 0s on the right hand side of your answer as this will cost you marks. E.g. B0 isn’t the same as B, just like 30 isn’t the same as 3.