Easy Way to Convert Base Ten to Hex
Download Article
Download Article
Hexadecimal is a base sixteen numeral system. This means it has 16 symbols that can represent a single digit, adding A, B, C, D, E, and F on top of the usual ten numerals. Converting from decimal to hexadecimal is more difficult than the other way around. Take your time learning this, as it's easier to avoid mistakes once you understand why the conversion works.
Converter
Small Number Conversions
Decimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Hex | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
-
1
Use this method if you're a beginner to hexadecimal. Of the two approaches in this guide, this one is easier for most people to follow. If you're already comfortable with different bases, try the faster method below.[1]
- If you're completely new to hexadecimal, you might want to learn the basic concepts.
-
2
Write down the powers of 16. Each digit in a hexadecimal number represents a different power of 16, just like each decimal digit represents a power of 10. This list of powers of 16 will come in handy during the conversion:[2]
- 165 = 1,048,576
- 164 = 65,536
- 163 = 4,096
- 162 = 256
- 161 = 16
- If the decimal number you're converting is larger than 1,048,576, calculate higher powers of 16 and add them to the list.
Advertisement
-
3
Find the largest power of 16 that fits in your decimal number. Write down the decimal number you're about to convert. Refer to the list above. Find the largest power of 16 that's smaller than the decimal number.
- For example, if you're converting 495 to hexadecimal, you would choose 256 from the list above.
-
4
Divide the decimal number by this power of 16. Stop at the whole number, ignoring any part of the answer past the decimal point.[3]
- In our example, 495 ÷ 256 = 1.93... , but we only care about the whole number 1.
- Your answer is the first digit of the hexadecimal number. In this case, since we divided by 256, the 1 is in the "256s place."
-
5
Find the remainder. This tells you what's left of the decimal number to be converted. Here's how to calculate it, just as you would in long division:
- Multiply your last answer by the divisor. In our example, 1 x 256 = 256. (In other words, the 1 in our hexadecimal number represents 256 in base 10).
- Subtract your answer from the dividend. 495 - 256 = 239.
-
6
Divide the remainder by the next higher power of 16. Refer back to your list of powers of 16. Move down to the next smallest power of 16. Divide the remainder by that value to find the next digit of your hexadecimal number. (If the remainder is smaller than this number, the next digit is 0.)[4]
- 239 ÷ 16 = 14. Once again, we ignore anything past the decimal point.
- This is the second digit of our hexadecimal number, in the "16s place." Any number from 0 to 15 can be represented by a single hexadecimal digit. We will convert to the correct notation at the end of this method.
-
7
Find the remainder again. As before, multiply your answer by the divisor, then subtract your answer from the dividend. This is the remainder still to be converted.
- 14 x 16 = 224.
- 239 - 224 = 15, so the remainder is 15.
-
8
Repeat until you get a remainder below 16. Once you get a remainder from 0 to 15, it can be expressed by a single hexadecimal digit. Write this down as a final digit.
- The last "digit" of our hexadecimal number is 15, in the "1s place."
-
9
Write your answer in the correct notation. You now know all the digits of your hexadecimal number. But so far, we've only been writing them in base 10. To write each digit in proper hexadecimal notation, convert them using this guide:
- Digits 0 through 9 remain the same.
- 10 = A; 11 = B; 12 = C; 13 = D; 14 = E; 15 = F
- In our example, we ended up with digits (1)(14)(15). In the correct notation, this becomes the hexadecimal number 1EF.
-
10
Check your work. Checking your answer is easy when you understand how hexadecimal numbers work. Convert each digit back into decimal form, then multiply by the power of 16 for that place position. Here's the work for our example:
- 1EF → (1)(14)(15)
- Working right to left, 15 is in the 160 = 1s position. 15 x 1 = 15.
- The next digit to the left is in the 161 = 16s position. 14 x 16 = 224.
- The next digit is in the 162 = 256s position. 1 x 256 = 256.
- Adding them all together, 256 + 224 + 15 = 495, our original number.
Advertisement
-
1
Divide the decimal number by 16. Treat the division as an integer division. In other words, stop at a whole number answer instead of calculating out the digits after the decimal point.
- For this example, let's be ambitious and convert the decimal number 317,547. Calculate 317,547 ÷ 16 = 19,846, ignoring the digits after the decimal point.
-
2
Write down the remainder in hexadecimal notation. Now that you've divided your number by 16, the remainder is the part that can't fit into the 16s place or higher. Therefore, the remainder must be in the 1s place, the last digit of the hexadecimal number.
- To find the remainder, multiply your answer by the divisor, then subtract the result from the dividend. In our example, 317,547 - (19,846 x 16) = 11.
- Convert the digit into hexadecimal notation using the small number conversion chart at the top of this page. 11 becomes B in our example.
-
3
Repeat the process with the quotient. You've converted the remainder into a hexadecimal digit. Now to continue converting the quotient, divide it by 16 again. The remainder is the second-to-last digit of the hexadecimal number. This works from the same logic as above: the original number has now been divided by (16 x 16 =) 256, so the remainder is the portion of the number that can't fit into the 256s place. We already know the 1s place, so this remainder must be the 16s place.
- In our example, 19,846 / 16 = 1240.
- Remainder = 19,846 - (1240 x 16) = 6. This is the second-to-last digit of our hexadecimal number.
-
4
Repeat until you get a quotient smaller than 16. Remember to convert remainders from 10 to 15 into hexadecimal notation. Write each remainder down as you go. The final quotient (smaller than 16) is the first digit of your number. Here's our example continued:
- Take the last quotient and divide by 16 again. 1240 / 16 = 77 Remainder 8.
- 77 / 16 = 4 Remainder 13 = D.
- 4 < 16, so 4 is the first digit.
-
5
Complete the number. As mentioned earlier, you're finding each digit of the hexadecimal number from right to left. Check your work to make sure you wrote them in the right order.
- Our final answer is 4D86B.
- To check your work, convert each digit back to a decimal number, multiply by powers of 16, and sum the results. (4 x 164) + (13 x 163) + (8 x 162) + (6 x 16) + (11 x 1) = 317547, our original decimal number.
Advertisement
Add New Question
-
Question
How do I convert 1111001 to a hexadecimal?
Since every 4 bits in a binary code is 1 bit in hex, the best thing to do is convert each 4 bits into a decimal number then into a hex number. 1001 would be 8 plus 1 which would then be 9. 0111 would be 4 plus 2 plus 1 which would then be 7. The answer is 79.
-
Question
Can I convert decimals to hexadecimals?
Start with number n, for the sake of having an example, let's say 86. Take the number and divide by 16 -> 5R6. If the result of your initial division (not the remainder) is greater than 16, then you must divide that number by 16. In this case, 86dec is equal to 56hex.
-
Question
How do I convert 98735 base 2 to hexadecimal?
98735 is not in base 2. The figures should not be larger than the base. 98735 to binary (base 2) is 11000000110101111.
-
Question
How do I convert 145.02 base 8 to hexadecimal?
145.02/64 = 2.265 2x64 = 128 145.02 - 128=17.02 17.02/8 = 2.1275 2x8 = 16 17.02 - 16 = 1.02 Result = 221.02 in hex.
-
Question
I am struggling with the Fast Remainder method. I don't understand why it works. Why - the remainders can contribute to a correct answer for the whole? Yet, it seems to be very popular, so I am trying
This is going to sound stupid, but it might help explain why the algorithm is "obviously" correct: Try using it to convert base 10 to base 10. Pick any number in base 10, say 15069. Divide it by 10. 1506, remainder 9. Divide 1506 by 10. 150, remainder 6. Divide 150 by 10. 15, remainder 0. Divide 15 by 10. 1, remainder 5. Divide 1 by 10. 0 remainder 1. See? It really is obvious. Each time, you're just picking off the least significant digit in whatever base you divide by.
-
Question
Find the solutions in hexadecimal of: 4E + 6B?
4E is 78 in decimal (10 base). 6B is 107. 78 + 107 = 185. Which is B9 in hexadecimal.
-
Question
How do you convert a negative decimal to hex, using the first method? Example -495 according to the programmer calculator is FFFF FFFF FFFF FE11. How do you get that the longhand way?
You first figure out the hex of the positive value, which is 1ef, then for each digit do (15 - digit) so 1ef becomes e10, then add 1 to that hex, e10 becomes e11, then add an f to the beginning. e11 becomes fe11.
-
Question
I have another question. Using the first method dec 1079160 returns 17778, while the actual hex answer, according to a programmer calculator is 107778. Is there a way to correct this?
In the first step, if the decimal remainder is less than 0.0625 you add at least one 0 to the digit. If there are more than 1 zeros to the right of the period, you count the zeros and subtract 1 and add that many zeros to your digit. Examples: 1,078,160 / 1,048,576 = 1.029. So the first digit is 10. In the next step you still do 1 x 1,048,576, not 10 x 1048576. Another example: 4097 to hex. 4097 / 4096 = 1.000244. There are 3 zeros to the right of the period, so your first digit is 100. 4096 X 1 = 4096. 4097 - 4096 = 1. hex answer = 1001.
-
Question
How do I convert 10001101010001101111 to hexadecimal?
Assuming this is binary (if this is decimal, convert it to binary). Split the binary into 4 bit chunks (nibbles): 1000 1101 0100 0110 1111. Convert the nibbles into the hexadecimal: 8D46F.
-
Question
How to convert decimal number 1011 to hexdecimal?
Start by converting the decimal 1011 to binary: 1111110011. Now break the binary number into nibbles (4 bits/binary digits): 0011 1111 0011. Now convert the nibbles into their respective hexadecimal: 3F3.
Show more answers
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement
-
To avoid confusion while using different numeral systems, you may write the base as a subscript. For example, 51210 means "512 base 10," an ordinary decimal number. 51216 means "512 base 16," equivalent to the decimal number 129810.
Thanks for submitting a tip for review!
Advertisement
Video
About This Article
Article Summary X
1. Write down the powers of 16.
2. Find the largest power that fits in your decimal number.
3. Divide the decimal number by this power of 16.
4. Find the remainder.
5. Divide the remainder by the next higher power of 16.
6. Find the remainder again.
7. Repeat until you get a remainder below 16.
8. Write your answer in the correct notation.
Did this summary help you?
Thanks to all authors for creating a page that has been read 1,316,496 times.
Is this article up to date?
Source: https://www.wikihow.com/Convert-from-Decimal-to-Hexadecimal
0 Response to "Easy Way to Convert Base Ten to Hex"
Postar um comentário