Larold’s Jubilant Junkyard” has become “Larold’s Retro Gameyard“. I’ve been working on this re-branding and migration for a while. All old tutorials should redirect you to this new site. If you see any errors, please let me know! See here for more information: What happened to Larold’s Jubilant Junkyard?

How to read Hexadecimal

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.

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:

How to read hexadecimal – Converting numbers to bits and back

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:

BinaryDecimalHexadecimal Character
000000
000111
001022
001133
010044
010155
011066
011177
100088
100199
101010A
101111B
110012C
110113D
111014E
111115F

This is done for each 4 bits of a given binary number.

How to read hexadecimal – converting 100 & 125 to hexadecimal

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.

Step 1 – Convert 125 to binary

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.

Bits01111101
Power of 21286432168421

Step 2 – Split our binary into 2 (4-bit) binary numbers

Next we split those 8 bits into 2 4-bit codes. 01111101 becomes 0111 and 1101

0111 1101
0111 1101

When we convert these 2 4-bit binary codes to decimal (separately) we get 7 and 13 respectively.

0111 1101
7 13

Step 3 – Adjustment for numbers higher than 9

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:

BinaryDecimalHexadecimal Character
101010A
101111B
110012C
110113D
111014E
111115F

That’s it! I hope everything was clear. If so, you understand how to read hexadecimal now. Reach out to The Gameyard on social media or by email if you need more help. Please share this tutorial on social media if you found it helpful.

Leave a Reply

Your email address will not be published. Required fields are marked *

THANKS FOR READING!

If you have any suggestions, and/or are confused about anything: feel free to leave a comment, send me a email, or a message on social media. Constructive criticism will help the gameyard, and others like yourself. If you learned something from this tutorial, and are looking for more content, check other these other tutorials. 

Sign-Up for the "Gameyard Newsletter" for MOre Game Development News

If you like Retro Game Development, subscribe to the Gameyard Newsletter. Stay up-to-date with all the latest Game Boy news. It’s free, and you can unsubscribe any time!

Be sure to check your email inbox for a confirmation email.