Hexadecimal to Binary Conversion
To convert a hexadecimal number to binary, work through one hexadecimal digit at a time. Each digit turns into its own 4-bit nibble, and the nibbles are then written next to each other.
Each hexadecimal digit stands for one of 16 values, from 0 to 15. Digits 0 to 9 keep their usual value. For the letters, A stands for ten and F for fifteen, with B, C, D and E filling the values in between in order. Four bits give 2 to the power 4 = 16 different patterns, which is exactly enough for the 16 digit values, so each digit always needs exactly four bits. You do not need to turn the whole hexadecimal number into denary first; each digit is handled separately.
A nibble has the place values 8, 4, 2 and 1. Pick the place values that add up to the digit. For B, the value is 11, and 8 + 2 + 1 = 11, so B is 1011. The digit 4 needs only the 4 place value, so 4 is 0100. Keep the leading zero: every nibble must be exactly four bits.
| Hexadecimal digit | Denary value | 4-bit nibble |
|---|---|---|
| B | 11 | 1011 |
| 4 | 4 | 0100 |
| 2 | 2 | 0010 |
| D | 13 | 1101 |
Write the nibbles in the same order as the original hexadecimal digits. For B4, B gives 1011 and 4 gives 0100, so B4 = 10110100. Join the nibbles end to end; never add them together. Changing the order of the nibbles would give a different value. Any two-digit hexadecimal number gives exactly eight bits, with the smallest value using eight zeroes and the largest using eight ones.
Check by splitting the binary answer back into nibbles and converting each one: 1011 is 8 + 2 + 1 = 11 = B, and 0100 is 4, which returns the original B4.
OCR GCSE Computer Science · Hexadecimal to Binary Conversion
OCR GCSE Computer Science · Binary to Hexadecimal Conversion
OCR GCSE Computer Science · Hexadecimal to Denary Conversion