How to Convert Decimal Into Hexadecimal with Precision

How to Convert from Decimal to Hexadecimal?

Example: Let’s convert \(\mathsf{101.101_{10}}\) into base-16.

To begin the conversion, we separate the decimal number into its whole and fractional parts—interestingly, both share the same sequence: \(\mathsf{101}\).

During the conversion of decimal numbers to the hexadecimal system, it’s essential to recognize that the quotient values—or the whole number results derived from divisions or multiplications—can range up to 15 in base 10. Since hexadecimal is a base-16 system, each of the decimal values from 10 to 15 is represented by a corresponding symbol: \(\mathsf{10\rightarrow{}A,}\) \(\mathsf{11\rightarrow{}B,}\) \(\mathsf{12\rightarrow{}C,}\) \(\mathsf{13\rightarrow{}D,}\) \(\mathsf{14\rightarrow{}E}\) and \(\mathsf{15\rightarrow{}F.}\) Whether these values arise from converting the whole number portion or emerge during the fractional part multiplications, they must be written using their respective hexadecimal symbols to maintain accuracy and consistency in base representation.

The whole number conversion involves repeatedly dividing the number by the target base, which is \(\mathsf{16}\) in this case. At each step, the quotient is written below, and the remainder is noted beside it using a “quotient – remainder” format. This process continues until the quotient becomes zero. The hexadecimal equivalent of the whole number is then formed by writing down the collected remainders in reverse order, starting from the final division result.

this image shows the step by step conversion of the whole part of the decimal number 101.101 into hexadecimal

This gives us \(\mathsf{65_{16}}\), the hexadecimal representation of \(\mathsf{101_{10}}\).

Alternatively, when the division steps are expressed as fractions rather than the “quotient – remainder” format, the conversion method slightly shifts in approach. The fractional part of each division result is then used as input for the next step, where it is multiplied by the base to isolate a whole number. This whole number represents the remainder at that stage, while the remaining fractional part continues the chain of multiplications. After performing these iterative steps, the resulting whole number digits are gathered in reverse order to form the final base representation. This approach maintains accuracy and structure, even when the division is recorded in fractional form rather than discrete quotient-remainder pairs.

this image shows the step by step conversion of the whole part of the decimal number 101.101 into hexadecimal, when the result is written as a fraction

For the fractional component, the method involves multiplying the fractional part \(\mathsf{0.101_{10}}\) by the base, and extracting the whole number portion of the result during each iteration. This whole number becomes the next digit in the hexadecimal result, while the remaining fractional part is used in the subsequent multiplication. The iterations continue either until a complete whole number is produced or the desired level of precision—three hexadecimal digits in this example—is achieved.

this image shows the step by step conversion of the fractional part of the decimal number 101.101 into hexadecimal

The hexadecimal equivalent of the fractional part, computed through this method, is \(\mathsf{19D_{16}}\).

After separately converting both the whole and fractional components using their respective methods, we combine the results to form the complete hexadecimal representation. Thus, the decimal number \(\mathsf{101.101_{10}}\) is equivalently expressed in hexadecimal as \(\mathsf{65.19D_{16}}\), with the fractional part computed to \(\mathsf{3}\) bits of precision.

The reverse of this calculation is performed in hexadecimal to decimal conversion.