How to Convert Decimal to HEX
Decimal to hexadecimal conversion is the process of converting a decimal number with a base of 10 to a hexadecimal number with a base of 16.
Decimal to Hexadecimal
Decimal to hexadecimal is a system of conversion that is often used in computers and digital systems. The decimal number system has a base of 10. It has only 10 notations, i.e., 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Whereas the hexadecimal system operates with a base of 16 because there are a total of 16 notations in it: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and A, B, C, D, E, F. To denote the double digits 10, 11, 12, 13, 14, 15 in the hexadecimal number system, we use characters A, B, C, D, E, F respectively. Let us learn more about the conversion methods of decimal to hexadecimal and the steps of conversion associated with it.
What is Decimal to Hexadecimal Conversion?
Decimal to hexadecimal conversion is the process of converting a decimal number with a base of 10 to a hexadecimal number with a base of 16. While converting a number from the decimal number system to the hexadecimal number system, we need to carefully observe the base of the number. The number needs to be divided by 16 until the quotient is zero. Observe the following table which shows the representation of decimal numbers and hexadecimal numbers.
How to Convert Decimal to Hexadecimal?
In order to convert decimal to hexadecimal, we need to do some basic mathematical calculations using the following steps.
- Step 1: Divide the given decimal number system value by 16 and note the remainder.
- Step 2: Divide the quotient by 16. Repeat this until you get a quotient equal to zero.
- Step 3: Use the characters A, B, C, D, E, F in place of 10, 11, 12, 13, 14, 15 in the remainders respectively, wherever needed.
- Step 4: Follow the reverse order pattern to arrange all the values of the remainder.
- Step 5: The obtained number is the required hexadecimal number.
The Decimal to hexadecimal conversion formula of given numbers can be expressed as,
P10 = Q16
where P is a decimal number and Q is a hexadecimal number.
Let us understand how to convert a decimal number to a hexadecimal number with the help of the following example.
Example: Convert 5386 to a hexadecimal number.
Solution: We will use the following steps to convert 5386 to hexadecimal.
- Step 1: Divide 5386 by 16 to get 336 as the quotient and note the remainder 10.
- Step 2: Divide the quotient 336 obtained from the previous step by 16 to get 21 as the next quotient and note the remainder 0.
- Step 3: Divide the quotient 21 by 16 to get 1 as the new quotient and note the remainder 5.
- Step 4: Divide the quotient 1 by 16 to get 0 as the new quotient and note the remainder 1. Since we get 0 as the quotient, we stop here.
- Step 5: Now, reverse the remainders and note the combined number that it forms. We need to keep in mind that 10 is written as A in the hexadecimal number system.
- Step 6: After writing the remainders in the reverse order we get, 150A. Therefore, 5386 is expressed as 150A in the hexadecimal number system. This can be written as (5386)10 is equal to (150A)16.
Convert Decimal to Hexadecimal With Decimal Point
In order to convert any fractional number to a hexadecimal number, we convert the integer part in the usual way as shown above and we multiply the fractional part (decimal part) by 16. Since the base of a hexadecimal number is 16 we multiply the fractional part by 16 until it becomes 0. We need to note down the integer part of these products after every step. The obtained result is the hexadecimal number of the given fractional number. Let us understand this with the help of an example.
Example: Convert the fractional decimal number 18.765625 into a hexadecimal number.
Solution: We will solve the integer part and fractional part individually.
- Step 1: First let us work on the integer part. After we divide 18 by 16, we get the quotient as, 18 ÷ 16 = 1 and the remainder as 2.
- Step 2: Now, when we divide 1 by 16, we get the quotient as, 16 ÷ 1 = 0, and the remainder as 1.
- Step 3: Now, let us note the combined form of the remainders by reversing them, which makes it 12. This will be written as the integer part of the hexadecimal value.
- Step 4: After this step, we will work on the fractional part which is 0.765625
- Step 5: We need to multiply 0.765625 by 16 which will give 0.765625 × 16 = 12.25 in which we will note the integer part 12. This 12 is expressed as C in the hexadecimal number system.
- Step 6: Now, we will multiply the fractional part of this product by 16 again. After multiplying the fractional part 0.25 by 16 we get, 0.25 × 16 = 4
- Step 7: Now, after we combine the integer part and the fractional part of the hexadecimal form we get, 12.C4. Therefore 18.765625 is equal to 12.C4 in the hexadecimal number system. This means (18.765625)10 is equal to (12.C4)16.
Decimal to Hexadecimal Conversion Example
Example : Convert the 592 decimal to hexadecimal.
Solution:
To convert 592 decimal to hexadecimal let us follow the given steps.
592÷16
Remainder = 0, Quotient = 3737÷16
Remainder = 5, Quotient = 22÷16
Remainder = 2, Quotient = 0(592)10 =