Conversion Between Binary and Hexadecimal

In the GCSE Computer Science exam you could be asked why we might use hexadecimal rather than binary. The two main reasons are that:

Below you can see a binary number and a hexadecimal number. Changing one will change the other and allow you to investigate the conversion process. You can click a binary digit to toggle it between 0 and 1. You can click a hexadecimal digit to increase its value, or right-click to decrease the value. The concatenated result and the denary equivalent will be shown at the bottom.

8
0
4
0
2
0
1
0
8
0
4
0
2
0
1
0
bracket
bracket
0
0
0
0
00000000 in binary is 00 in hexadecimal (and 0 in denary)

To convert binary numbers to hexadecimal, we group the bits into blocks of four (i.e. a nibble) and then convert each group into a single hexadecimal digit and then concatenate the resulting digits. In the exam you will usually do this with a whole byte (i.e. eight bits), but if the number of bits isn't a multiple of four then you need to group them into fours starting with the least-significant bit (i.e. on the right).

To convert hexadecimal to binary, convert each hexadecimal digit into a four-bit binary number and concatenate the results. Each binary number must have four bits - if the hexadecimal digit is less than eight then you will need to add leading zeros.