Base Converter guide
How to Convert Binary to Hexadecimal
Split the binary number into groups of four digits, starting from the right, then convert each group into a single hex digit. For 11010110, the groups are 1101 and 0110, which become D and 6 — so the answer is D6. No arithmetic is needed.
This is the easiest conversion there is
Binary and hexadecimal fit together perfectly, because 16 is 2 to the power of 4. That means one hex digit is exactly four binary digits, always, with no carrying and no remainders.
So converting between them is pure substitution. You are not calculating anything — you are looking things up.
The lookup table
This is worth getting familiar with. Sixteen rows, and then you never need to think about this conversion again.
| Binary | Hex | Binary | Hex |
|---|---|---|---|
| 0000 | 0 | 1000 | 8 |
| 0001 | 1 | 1001 | 9 |
| 0010 | 2 | 1010 | A |
| 0011 | 3 | 1011 | B |
| 0100 | 4 | 1100 | C |
| 0101 | 5 | 1101 | D |
| 0110 | 6 | 1110 | E |
| 0111 | 7 | 1111 | F |
The method
Split the binary number into groups of four, starting from the right. Then swap each group for its hex digit.
For 11010110: split into 1101 and 0110.
1101 is D. 0110 is 6.
So 11010110 is D6. That is the whole conversion — no adding, no dividing.
Padding the left-hand group
If the number of digits is not a multiple of four, the leftmost group will be short. Pad it with zeros on the left until it has four digits.
So 110110 splits into 11 and 0110. Pad the 11 to 0011, which is 3, and 0110 is 6. The answer is 36.
Adding zeros on the left never changes a number's value, exactly as writing 42 as 0042 does not change it. Adding them on the right would multiply it by 16, which is why the direction matters.
Going the other way
Hex to binary is the same trick in reverse: replace each hex digit with its four binary digits, and run them together.
D6 becomes 1101 and 0110, which is 11010110. Back where we started.
Keep the leading zeros in the middle groups when you do this. Writing 6 as 110 instead of 0110 loses a position and corrupts everything to its left.
Why octal uses groups of three
The same trick works for octal, because 8 is 2 to the power of 3. So one octal digit is exactly three binary digits.
Splitting 11010110 into threes from the right gives 11, 010 and 110 — pad the first to 011 — which is 3, 2, 6, so 326 in octal.
This is why octal and hex are the two bases you meet alongside binary. They are the ones that line up with it exactly.