This calculator can be used to convert a number from the decimal system to the hexadecimal system (or vice versa).
convert hexadecimal to decimal
To convert a number from the hexadecimal system to a number in the decimal system, the last digit has to be multiplied by 160 = 1, the second last digit by 161 = 16, the third from last digit by 162 = 256, and so on. To obtain the result, the sum of the products has to be calculated.
Hexadecimal numbers can contain characters from A to F. Here, the A represents the 10 from the decimal system, the B represents the 11, the C represents the 12, the D represents the 13, the E represents the 14, and the F represents the 15. If the hexadecimal number contains a character, the number that the character represents is multiplied by the power of 16.
As an example, A3F16 is to be converted from the hexadecimal system to the decimal system.
|A3F16||≙||10 ∙ 162 + 3 ∙ 161 + 15 ∙ 160|
|=||2560 + 48 + 15|
Convert hexadecimal numbers with fractional places:
If you want to convert a hexadecimal number with places behind the point into the decimal system, you have to multiply the first decimal place with 16-1, the second with 16-2, the third with 16-3 and so on. From the results, the sum is calculated and added to the sum obtained for the digits before the decimal point.
For example, if you want to convert 2.5D116 from the hexadecimal system to the decimal system, you calculate:
|2.5D116||≙||2 ∙ 160 + 5 ∙ 16-1 + 13 ∙ 16-2 + 1 ∙ 16-3|
|=||2 ∙ 1 +|
|=||2 + 0.3125 + 0.05078125 + 0.000244140625|
convert decimal to hexadecimal
A number can be converted from the decimal system to the hexadecimal system either by dividing it repeatedly by 16 with remainder or by using powers of 16.
divide by 16:
In this method, the number to be converted is divided by 16 with remainder. The integer part of the result is divided by 16 again and this is done until the integer part is 0. The number in the decimal system is obtained by appending the remainders from bottom to top. If the remainder is greater than 9, the corresponding character must be appended instead of the remainder. For example, A instead of 10 or F instead of 15.
Assume that the number 2623 is to be converted into the hexadecimal system. Then one calculates:
Since in the remainder the 10 is converted to an A and the 15 is converted to an F, the following holds:
262310 ≙ A3F16
Calculation with decimal point:
If the number that you want to convert from the decimal system to the hexadecimal system contains a decimal point, you have to divide it into an integer part and a fractional part. The integer part is converted into the hexadecimal system as shown above. For the fractional part, multiply the fractional part by 16. If the result is not an integer, multiply the fractional part of the product by 16 again. Do this until the result of the multiplication is an integer or until you have enough decimal places for the desired accuracy. To get the fractional places in the system of 16, the numbers before the decimal point of the results of the multiplications are written one after the other from top to bottom. Again, numbers greater than 9 are replaced by the corresponding character. Finally, the converted part before the decimal point and the converted part after the decimal point simply have to be combined.
As an example, 2623.363525390625 is to be converted from the decimal system to the hexadecimal system. First, the number is divided into an integer part and a fractional part. So 2623 and 0.363525390625. 2623 is converted as described above and you get: 262310 ≙ A3F16
For the fractional part you calculate:
Since the 13 is replaced by a D, the result is: 0.36352539062510 ≙ 0.5D116
If you now put the integer part and the fractional part together, you get: 2623.36352539062510 ≙ A3F.5D116
with potencies of 16:
In this method, one first determines the largest power of 16 that is less than or equal to the number to be converted.
Then determine how often this power of 16 fits into the number and subtract from the number the product of the power of 16 and the number of times the power of 16 fits into the number.
In the next step you do the same as in the previous step but with the result of the subtraction and the next smaller power of 16. Repeat this until you have also done this with the power of 16 160.
To get the result in the hexadecimal system, the values, how often the powers of 16 have fitted into the numbers, have to be concatenated. Values greater than 9 are replaced by the corresponding character.
As an example, 2623 shall be converted to the hexadecimal system. The largest power of 16 that is less than or equal to 2623 is 162 = 256.
162 = 256 fits 10 times into the 2623. So you calculate 2623 - 10 ∙ 256 = 2623 - 2560 = 63
161 = 16 fits 3 times into the 63. So you calculate 63 - 3 ∙ 16 = 63 - 48 = 15
160 = 1 fits 15 times into the 15.
The 10 is replaced by an A and the 15 by an F. Therefore applies: 262310 ≙ A3F16
with powers of 16 and decimal point:
If you want to convert a number with decimals from the decimal system to the hexadecimal system, you have to divide the number into an integer part and a fractional part. The integer part is converted as described above.
The procedure for the fractional part is similar to that for the integer part. You calculate how many times 16-1 fits into the fractional part and then you subtract the product of the determined number of times and the power of 16 from the fractional part.
After that you determine how many times 16-2 fits into the calculated number from the previous step and subtract the product of the number of times and 16-2 from this number. This is done until either the result of the subtraction is 0 or until you have enough decimal places for the desired accuracy.
As an example, 2623.363525390625 is to be converted from the decimal system to the hexadecimal system.
First, the number is divided into an integer part (2623) and a fractional part (0.363525390625) and the integer part is converted as described above.
For the fractional part, determine how many times 16-1 = 0.0625 fits into the 0.363525390625 (5 times). So you calculate 0.363525390625 - 5 ∙ 16-1 = 0.051025390625
Then determine how many times 16-2 = 0.00390625 fits into 0.051025390625. That is 13 times. So you calculate man 0.051025390625 - 13 ∙ 16-2 = 0.000244140625
Next, determine how many times 16-3 = 0.000244140625 fits into the 0.000244140625. That is 1 times. So you calculate 0.000244140625 - 1 ∙ 16-3 = 0
For the places behind the point in the hexadecimal system the 5, 13 and 1 are important. The 13 is replaced by a D. So you get for the fractional part: 0.36352539062510 ≙ 0.5D116
If you now combine the integer part and the fractional part, you get 2623.36352539062510 ≙ A3F.5D116