### Tech moves fast! Stay ahead of the curve with Techopedia!

Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.

Decimal to hexadecimal (D2X) is a conversion process involving the two aforementioned number systems. The original number is in decimal format, base 10, and is converted to hexadecimal format, base 16.

The conversion can be done by dividing the decimal value by 16, which is the base value of hexadecimal, taking note of the remainder, and then dividing the result with 16 again and taking note of the remainder. The remainders are written from right to left and are the actual representation of the hexadecimal value when converted to the equivalent hex digit.

Decimal to hexadecimal conversion is often done for the benefit of the human reader because computers can already understand any of the given number systems. Often, hexadecimal is used for displaying values because they effectively shorten the number of characters due to its larger base value of 16. Hexadecimal values are 0 to 9 and A to F, which is essentially the same as 0 to 9 and 10 to 15 in decimal, totaling 16 values, hence the base 16.

In order to convert decimal to hexadecimal, modulo operation must be used. The given decimal value must be divided by 16. The remainder is the first hexadecimal value (which is still in decimal), which is written at the rightmost side. The quotient of the first division is then divided again by 16 and the remainder becomes the second hex value, still in decimal form. The process is continued until the quotient becomes less than 16, which results in a quotient of 0 and a remainder of less than 16, which is now the last hexadecimal value.

For example, the decimal "317,547" is converted to hexadecimal:

- 317,547 ÷ 16 = 19,846 modulo (remainder) 11 [B]

19,846 ÷ 16 = 1240 mod 6 [6]

1240 ÷ 16 = 77 mod 8 [8]

77 ÷ 16 = 4 mod 13 [D]

4 ÷ 16 = 0 mod 4 [4]

317,547 = 4D86B

Hexadecimal effectively shortens the value from six decimal digits to only five hexadecimal digits. When using a calculator, a quotient and some numbers are given after a decimal point. These numbers are the remainder, so they must be multiplied by 16 and rounded up to the nearest one’s place in order to get the whole number of the remainder or modulo.

Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.