How to Convert Decimal Into Binary with Precision

How to Convert from Decimal to Binary?

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

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

The whole number conversion involves repeatedly dividing the number by the target base, which is \(\mathsf{2}\) 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 binary 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 binary

This gives us \(\mathsf{1100101_2}\), the binary 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 binary, 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 binary 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—seven binary 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 binary

The binary equivalent of the fractional part, computed through this method, is \(\mathsf{0001100_2}\).

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

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