Hexadecimal to Decimal Conversion
To convert from Hexadecimal to Decimal we multiply the value in each position by its hex weight and add each value.
Let us take an example to better understand the procedure. Assume that we have any hexadecimal number 3ABE to be converted to its equivalent decimal number. Then the procedure will be as follows:
3*163 + A*162 + B*161 + E*160
= 3* 4096 + 10* 256 + 11*16 + 14
= 12288 + 2560 + 176 + 14
= 15038
Thus the equivalent decimal number for the hexadecimal number 3ABE is 15038.
Decimal to Hexadecimal Conversion
To convert decimal to hexadecimal, the typical method is repeated division by 16. For this method, we divide the decimal number by 16 and write the remainder on the side as the least significant digit.
This process is continued by dividing the quotient by 16 and writing the remainder until the quotient is 0. When performing the division, the remainders which will represent the hex equivalent of the decimal number are written beginning at the least significant digit (right) and each new digit is written to the next more significant digit (the left) of the previous digit.
Let us learn it with example. We take the decimal number 15038 which we got after conversion above. By this we can also check the above conversion and vice-versa.
Division |
Quotient |
Remainder |
Hex Number |
15038 / 16 |
939 |
14 (E H) |
E |
939 / 16 |
58 |
11 (B H) |
BE |
58 / 16 |
3 |
10 (A H) |
ABE |
3 / 16 |
0 |
3 (3 H) |
03ABE |
|