Sign-up for the Junkyard Newsletter!
Receive updates as soon as possible, by signing up for the Junkyard Newsletter. Get all the latest information delivered straight to your email box. New Tutorials, New Events, Game Reviews, Giveaways and more.
Hexadecimal is a base 16 numeral system. It can seem very weird at times. Maybe because of the inclusion of letters A-F, or because 64 = 100? Either way, you should have a good understanding of how to read hexadecimal by the end of this tutorial.
Reading Hexadecimal requires knowledge of binary code. If you need a quick refresher on binary check out my tutorial on “How to read Binary“. This tutorial about how to read hexadecimal will be “to the point”, so if you want something more in-depth maybe try wikipedia? Additionally, if you just need some quick calculators:
Hexadecimal is a base 16 numeral system. This means that 16 alphanumeric characters are used in representing numbers. These characters are 0-9 and A-F. Each digit in a hexadecimal number represents 4 bits. These 4-bits can make 16 possible numbers. Specifically, any integer between 0 and 15.
To convert to hexadecimal, For a given 4 bits calculate it’s decimal equivalent, then map that value using the following table:
Binary | Decimal | Hexadecimal Character |
0000 | 0 | 0 |
0001 | 1 | 1 |
0010 | 2 | 2 |
0011 | 3 | 3 |
0100 | 4 | 4 |
0101 | 5 | 5 |
0110 | 6 | 6 |
0111 | 7 | 7 |
1000 | 8 | 8 |
1001 | 9 | 9 |
1010 | 10 | A |
1011 | 11 | B |
1100 | 12 | C |
1101 | 13 | D |
1110 | 14 | E |
1111 | 15 | F |
This is done for each 4 bits of a given binary number.
Let’s convert 100 to hexadecimal. As per our “How to read binary” tutorial, 100 is 01100100 in binary. We next split that binary code into 2 4-bit binary codes 0110 and 0100. 0110 in binary equals 6 in decimal. Additionally, 0100 in binary equals 4 in decimal. We combine the two to get 64. So 100 in decimal, is 64 in hexadecimal.
A slightly more complicated scenario is when numbers are included. Let’s convert 125 to hexadecimal.
125 as binary is 01111101. If we add up all the numbers, except 2 (the 2nd least significant bit) and 128 (the most significant bit) we get 125.
Bits | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 |
Power of 2 | 64 | 32 | 16 | 8 | 4 | 1 |
Next we split those 8 bits into 2 4-bit codes. 01111101 becomes 0111 and 1101
0111 | 1101 | |||||||
0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 |
When we convert these 2 4-bit binary codes to decimal (separately) we get 7 and 13 respectively.
0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | |
7 | 13 |
Unfortunately, unlike with 100, we cannot simply combine the two and be done. There is one more step needed, then you know how to read hexadecimal. The 13 must be converted to D. After that, we can combine the two to make 7D.
Note: Computers will commonly prefix hexadecimal numbers with “0x”. This prevents confusion like 64 = 100. When the computer reads 0x64, it knows the value is in hexadecimal.
This final step only has to happen when 4-bits add up to more than 9. Here is a helper table again:
Binary | Decimal | Hexadecimal Character |
1010 | 10 | A |
1011 | 11 | B |
1100 | 12 | C |
1101 | 13 | D |
1110 | 14 | E |
1111 | 15 | F |
That’s it! I hope everything was clear. If so, you understand how to read hexadecimal now. Reach out to The Junkyard on social media or by email if you need more help. Please share this tutorial on social media if you found it helpful.
Receive updates as soon as possible, by signing up for the Junkyard Newsletter. Get all the latest information delivered straight to your email box. New Tutorials, New Events, Game Reviews, Giveaways and more.
If you like Game Boy Game Development, subscribe to the Junkyard Newsletter. Stay up-to-date with all the latest Game Boy news. It’s free, and you can unsubscribe any time!