How to Convert Decimal to Hexadecimal


Dec-to-Hex and Hex-to-Dec Calculator

The hexadecimal (base-16) number system allows you to encode numbers more efficiently than in lower base number systems, such as binary (base-2) or decimal (base-10). The hexadecimal system uses the digits 0 through 9 plus the first six letters of the alphabet to create a base-16 number system. The letters A, B, C, D, E, and F stand for the numbers 10 through 15 respectively. For example, the number that is written as 51973 in the decimal system is written as CB05 in the hexadecimal system.

If you want to convert a base-10 number into a base-16 number by hand, use the guide below. You can also use the easy conversion calculator on the left.

(Step 1) First, examine the powers of 16:
160 = 1
161 = 16
162 = 256
163 = 4096
164 = 65536
165 = 1048576
...

For the base-10 number that you want to convert, find the power of 16 that is closest to the decimal number without going over. For example, if you want to convert 51973, then you would pick 163 = 4096, since 65536 is too large.

(Step 2) Look at the power of 16 that you picked in Step 1, and add 1 to the exponent. For example, since 4096 = 163, then you add 3 + 1 = 4. This tells you how many digits the equivalent hexadecimal number will have. So 51973 will have 4 digits in base-16.

(Step 3) To find the first digit of the hexadecimal number, divide the base-10 number by the number you picked in Step 1, and keep the remainder. For example, 51973/4096 = 12 with remainder 2821. Since 12 is equivalent to C in hexadecimal, the first digit is C.

(Step 4) For the remainder you found in Step 3, repeat Steps 1 and 3. For example, 2821 is between 162 = 256 and 163 = 4096, so we will pick 256. Next, divide 2821 by 256 and keep the remainder. So 2821/256 = 11 with remainder 5. Since 11 = B in hexadecimal, the second digit is B.

(Step 5) The remainder 5 is between 160 = 1 and 161 = 16 and so this will be the last digit, but notice that we did not end up with a remainder between 161 = 16 and 162 = 256. This means that the third digit is 0. Thus, the entire number is CB05.



© Had2Know 2010