How to Manually Convert Decimal to Hexadecimal?
Converting decimal numbers to hexadecimal is a straightforward process. Here, we'll show you how to manually convert decimal numbers into hexadecimal format, using two examples: 496 (an integer number) and 1025.50 (a floating point number).
In short:
To convert a decimal number, divide the number recursively by 16 until you get 0 as the final quotient. Then, write down the remainders in reverse order to get the Hexadecimal value."
For the fractional part, keep multiplying the fractional part by 16 until the fraction part becomes 0. Sometimes, the fraction part might not become 0 even after many multiplications. In such cases, take values up to a certain point, such as five or eight places.
In detail:
Let's first explore the general steps to convert an integer number into hexadecimal.
Step 1: Start by dividing the given decimal number by 16: [This is because the hexadecimal number system has a number base of 16]. Record both the result (quotient) and the remainder.
Step 2: Notice the Quotient (result of the division): If the result is not zero (0), continue the process.
Step 3: Continue the process: Continue this process, placing each remainder in sequence until the result or quotient becomes zero (0).
Step 4: Record the reminders: Write the reminders (from bottom to top) that we've got so far from these divisions. Begin with the Most Significant Bit (MSB) at the bottom, and keep going to the top until you reach the Least Significant Bit (LSB). The output is the hexadecimal equivalent of the decimal number.
Example: Converting 496 to Hexadecimal
To convert the decimal number 496 to hexadecimal, follow these steps:
#Steps |
Divide by 16 |
Result/ Quotient |
Remainders |
1 |
496 ÷ 16 |
31 |
0 (LSB) ↑ |
2 |
31 ÷ 16 |
1 |
F (F=15 in hexadecimal) |
1 |
1 ÷ 16 |
0 |
1 (MSB) ↑ |
So, (496)10 in decimal is equivalent to (1F0)16 in hexadecimal.
Now let's explore the general steps to Converting a Decimal fraction number to a Hexadecimal
When dealing with decimal fractions, the process involves two parts: first to convert the integer part, and then to convert the fractional part.
We have just discussed the general steps to convert an integer part. So we will not repeat those steps here.
In the second part, we'll need to convert the fractional part to hexadecimal. The general steps for this are given below:
Step 1: Multiply the fractional part by 16: [This is due to the fact that the hexadecimal number system has a number base of 16.] Also, notice both the integer and fractional parts of the result.
Step 2: Notice the fractional part of the result: If the fractional part of the result is anything other than zero (0), continue the multiplication process.
Step 3: Continue the process: Continue this process until you get a fractional part of "0". If you can not reach to zero after several attempts, record the result.
Step 4: Write the integer parts: Write the integer parts of the results from top to bottom. The top to bottom integer of the result is the hexadecimal equivalent of the decimal number.
Example: Converting 1025.50 to Hexadecimal
Integer Part = 1025
- 1025 ÷ 16 = 64 (quotient) and reminder = 1 (LSB)
- 64 ÷ 16 = 4 (quotient) and reminder = 0
- 4 ÷ 16 = 0 (quotient) and reminder = 4
Thus, the hexadecimal equivalent of the integer part (1025)10 is (1016)16.
Fractional Part 0.50
Please note that you need to multiply the fractional number till you reach a fractional part (0). Here, the fractional number is 0.50; so multiply it by 16. This gives you 8.00, with a fractional part of 0.
- 0.50 * 16 = 8 (integer part), and fractional part = 0.
Since we have reached to a fractional part of 0, we will stop the multiplication here. But, sometimes you may not reach 0 even after multiplying several times. In such cases, record the result up to the precision you want.
Thus, the hexadecimal equivalent of the fractional part (.50) is 8.
If we combine both these parts, it would become 401.8 in hexadecimal.
So, (1025.50)10 in decimal is equivalent to (401.8)16 in hexadecimal.
Please note that converting a decimal number to a binary, octal and hexadecimal all involve pretty much the same processes. To convert a decimal number to a binary, you divide the integer by 2 and multiply the fraction by 2. In the case of an octal conversion, you do the division, and multiplication with 8 and for hexadecimal, it is 16.