How to Convert Decimal To Hexadecimal: 15 Steps

Table of contents:

How to Convert Decimal To Hexadecimal: 15 Steps
How to Convert Decimal To Hexadecimal: 15 Steps

Video: How to Convert Decimal To Hexadecimal: 15 Steps

Video: How to Convert Decimal To Hexadecimal: 15 Steps
Video: Get Rid of Front Loader Washer Stink! 2024, December
Anonim

Hexadecimal is a base sixteen number system. This means that this system has 16 symbols that can represent a single digit, with the addition of A, B, C, D, E, and F in addition to the usual ten numbers. Converting decimal to hexadecimal is more difficult than the other way around. Take the time to learn it, you'll find it easier to avoid mistakes once you understand how conversions work.

Small Number Conversion

Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F

Step

Method 1 of 2: Intuitive Method

Convert from Decimal to Hexadecimal Step 1
Convert from Decimal to Hexadecimal Step 1

Step 1. Use this method if you are new to hexadecimal

Of the two approaches in this guide, the first is the easiest for most people to follow. If you're already familiar with different number bases, try the faster method below.

If you are completely new to hexadecimal, you may need to learn the basic concepts first

Convert from Decimal to Hexadecimal Step 2
Convert from Decimal to Hexadecimal Step 2

Step 2. Write down some numbers to the power of 16

Each digit in a hexadecimal number represents several different numbers of 16, just as each decimal number represents 10 to the power of 10. This list of 16 raised to the power will be useful during the conversion process:

  • 165 = 1.048.576
  • 164 = 65.536
  • 163 = 4.096
  • 162 = 256
  • 161 = 16
  • If the decimal number you are converting is greater than 1,048,576, calculate the higher power than the one on the list and add it to your list.
Convert from Decimal to Hexadecimal Step 3
Convert from Decimal to Hexadecimal Step 3

Step 3. Find the highest power of 16 that matches your decimal number

Write down the decimal number you want to convert. Use the list above. Find the highest power of 16 that is less than the decimal number.

For example, if you are going to convert 495 to hexadecimal, you would choose 256 from the list above.

Convert from Decimal to Hexadecimal Step 4
Convert from Decimal to Hexadecimal Step 4

Step 4. Divide the decimal number by 16 to the power of the previous step

Select the integer and ignore the number after the decimal point.

  • In this example, 495 256 = 1.93…, all we are concerned with is the integer

    Step 1..

  • The integer is the first digit of the hexadecimal number, because in this case the divisor is 256, the 1 being the "256s position."
Convert from Decimal to Hexadecimal Step 5
Convert from Decimal to Hexadecimal Step 5

Step 5. Find the rest

This is the decimal number left to convert. Here's how to calculate it as you can see in long division:

  • Multiply your last answer by the denominator. In this example, 1 x 256 = 256. (In other words, the number 1 in a hexadecimal number equals 256 in base 10).
  • Subtract the numerator from the result of the previous step. 495 - 256 = 239.
Convert from Decimal to Hexadecimal Step 6
Convert from Decimal to Hexadecimal Step 6

Step 6. Divide the remainder by the next 16 higher powers

Use the list of 16 to the power again. Proceed to the nearest smallest power. Divide the remainder by the power number to find the next digit of the hexadecimal number. (If the remainder is less than this number, the next digit is 0.)

  • 239 ÷ 16 =

    Step 14.. Again, we can ignore the numbers after the decimal point.

  • This is the second digit of the hexadecimal number in the "16s position." All numbers from 0 to 15 can be represented by a single hexadecimal digit. We will convert the proper notation at the end of this method.
Convert from Decimal to Hexadecimal Step 7
Convert from Decimal to Hexadecimal Step 7

Step 7. Find the rest again

As before, multiply your answer by the denominator, then subtract the result from the numerator. Here's the rest that still has to be converted.

  • 14 x 16 = 224.
  • 239 - 224 = 15, so the remainder is

    Step 15..

Convert from Decimal to Hexadecimal Step 8
Convert from Decimal to Hexadecimal Step 8

Step 8. Repeat until the remainder of the division is below 16

Once you get the remainder of a division between 0 and 15, it can be expressed as a single hexadecimal digit. Write as the last digit.

The last hexadecimal "digit" number is 15, in the "1s position."

Convert from Decimal to Hexadecimal Step 9
Convert from Decimal to Hexadecimal Step 9

Step 9. Write your answer in correct notation

Now you know all the digits of the hexadecimal number. But so far we're still writing them in base 10. To write each digit in proper hexadecimal notation, convert the numbers using this guide:

  • The digits 0 to 9 remain the same.
  • 10 = A; 11 = B; 12 = C; 13 = D; 14 = E; 15 = F
  • In the example above, the calculated digit is (1)(14)(15). The correct hexadecimal notation for this number is 1EF.
Convert from Decimal to Hexadecimal Step 10
Convert from Decimal to Hexadecimal Step 10

Step 10. Check your answers

You can easily check your answers if you understand how hexadecimal numbers work. Convert each digit back to decimal, then multiply by 16 to the power of the position. Here's how for our example above:

  • 1EF → (1)(14)(15)
  • From right to left, 15 is at 160 = position 1's. 15 x 1 = 15.
  • The next digit to the left is 161 = position 16s. 14 x 16 = 224.
  • The next digit is 162 = position 256s. 1 x 256 = 256.
  • Adding all, 256 + 224 + 15 = 495, the result is the initial decimal number.

Method 2 of 2: Fast Method (Time)

Convert from Decimal to Hexadecimal Step 11
Convert from Decimal to Hexadecimal Step 11

Step 1. Divide the decimal number by 16

Treat this division as integer division. In other words, stop at integers without counting the digits after the decimal point.

For this example, we will be ambitious and try to convert the decimal number 317,547. Calculate 317,547 16 = 19.846, ignore all digits after the decimal point.

Convert from Decimal to Hexadecimal Step 12
Convert from Decimal to Hexadecimal Step 12

Step 2. Write the remainder in hexadecimal notation

Now that you've divided the number by 16, the remainder is the part that doesn't fit into the 16s or higher place. Therefore, the remainder must be in the 1s position, digit final hexadecimal numbers.

  • To find the remainder, multiply your answer by the denominator, then subtract the result from the numerator. For the example above, 317,547 - (19,846 x 16) = 11.
  • Convert the digits to hexadecimal notation using the small number conversion table at the top of this page. In this example 11 becomes B.
Convert from Decimal to Hexadecimal Step 13
Convert from Decimal to Hexadecimal Step 13

Step 3. Repeat the process with the result of the division

You have converted the remainder to hexadecimal digits. Now proceed to convert the divisor, divide again by 16. The remainder is the 2nd digit from the back of the hexadecimal number. It works the same as the previous logic: the original number has now been divided by (16 x 16 =) 256, so the remainder is the part that can't be in the 256s position. We already understand the 1s, so the rest must be in the 16s.

  • For this example, 19,846 / 16 = 1240.
  • Remainder = 19,846 - (1240 x 16) =

    Step 6.. This is the 2nd last digit for the hexadecimal number.

Convert from Decimal to Hexadecimal Step 14
Convert from Decimal to Hexadecimal Step 14

Step 4. Repeat until you get a division result less than 16

Remember to convert the remainder from 10 to 15 to hexadecimal notation. Write down each remaining calculation. The result of the last division (less than 16) is the first digit of your hexadecimal number. Here's a continuation of our example:

  • Take the last division result and divide again by 16. 1240 / 16 = 77 Sisar

    Step 8..

  • 77 / 16 = 4 Remaining 13 = D.
  • 4 < 16, so

    Step 4. is the first digit.

Convert from Decimal to Hexadecimal Step 15
Convert from Decimal to Hexadecimal Step 15

Step 5. Complete the numbers

As mentioned earlier, you will get each digit of the decimal number from right to left. Check your work to make sure you have written it in the correct order.

  • The final answer is 4D86B.
  • To check your work, convert each digit back to a decimal number, multiply by 16 to the power of 16, and add up the results. (4 x 164) + (13 x 163) + (8 x 162) + (6 x 16) + (11 x 1) = 317547, the decimal number we use as an example.

Tips

To avoid confusion when using different number systems, you can write the base as a subscript. For example, 51210 means "512 base 10," a regular decimal number. 51216 means "512 base 16," the equivalent of the decimal number 129810.

Recommended: