For our example let's convert the hexadecimal number A7 to it's decimal equivalent.
The formula for this is decimal = first hex digit x 16 + second hex digit. To use the formula simply slot in the hex digits and if they are letters convert them to their decimal equivalent e.g. A = 10, B= 11 etc. Then work through the maths to the solution.
So in our example decimal = A x 16 + 7 = 10 x 16 + 7 = 160 + 7 = 167.
Therefore our A7 in hexadecimal is equivalent to 167 in decimal.
Enter the decimal equivalent above.
Decimal to hexadecimal
For our example let's convert the decimal number 94 to it's hexadecimal equivalent.
The first step is to perform a floor division of the number and 16. Floor division is where we get the answer to one number divide another ignoring any remainder. This will be the first hex digit so in our case 94//16 = 5.
Next we find the remainder of the same division. In Computer Science finding the remainder of a division is known as modulus. In our case 94 % 16 = 14 i.e. 94/16 = 5r14. Because our number is bigger than 9 we have to swap our decimal representation for its hex equivalent - E.
Therefore our final hex number is 5E
Column_heading |
16s |
1s |
Value |
5 |
E |
Double checking the maths by going back the other way we can see that 5 x 16 + 14 = 80 + 14 = 94
Decimal to hexadecimal practice
Click the button to get a number to convert
Enter text characters in lower or upper case.