Just like binary, we have hexadecimal numbers, but with 2 obvious differences. Now let’s learn hexadecimal numbers in detail.
The first difference is base 16. And second, obviously, it has 16 digits. But we have a problem here. We know only 10 digits 0…9. In hexadecimal we cannot put 10 as our tenth number, because it is hexadecimal, the series is supposed to go from 0 to 15 digits before it turns to 10.
Hence, in this system, we use alphabets like a, b, c, d, e, and f to represent those numbers. Therefore, the hexadecimal series goes like this:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10, 11, 12, 13, 14, and 15.
The method of converting Decimal to Hexadecimal, and Hexadecimal to Decimal remains the same, just like Binary Numbers. You can read the Binary Number article here.
While converting Decimal to Hexadecimal, we will divide the Decimal by the base number to which we are converting; and collect the reminders. In this case, the base number would be 16, and reminders will be anything between 0 to 15. Let us try a few examples.
Example 1. (26)10 = (?)16
Note that, the number 10 is A, in Hexadecimal.
So, (26)10 = (1A)16
Let’s try another example.
Example 2. (2052)10 = (?)16
Hence, (2052)10 = (804)16
As mentioned before, we will use the same method to convert Hexadecimals to Decimals, which we used to convert Binary Numbers to Decimals, but with the only difference, that we will be using multiples of 16, rather than 2.
Let us discuss this along with some examples.
Example 3. (2A)16 = (?)10
= (2 x 161)+ (A x 160)
= (2 x 161)+ (10 x 160)
= (2 x 16)+ (10 x 1)
= 32 + 10
= 42
Note:
Therefore, (2A)16 = (42)10
Let’s have another example.
Example 4. (9E)16 = (?)16
= (9 x 161)+ (E x 160)
= (9 x 161)+ (14 x 160)
= (9 x 16)+ (14 x 1)
= 144 + 14
= 158
Note:
Thus, (9E)16 = (158)10
Easy? Drop your question via email, and I will try my best to answer. Happy coding!