Table of Contents

Last modified on January 29th, 2024

A decimal-to-binary conversion is done to convert a decimal number (base 10) to its equivalent binary number (base 2). The methods used to convert a decimal number to its binary counterpart are discussed below.

In this method, the given decimal number is divided recursively by 2 until we get 0 as the final quotient.

Let us convert the decimal number (167)_{10} to its binary.

On dividing 167 by 2, we get quotient = 83 and remainder = 1

Further, the quotient 83 is divided by 2, here, the quotient is 41, and the remainder is 1.

We repeat the above step till we get the quotient as 0.

41 ÷ 2, quotient = 20, and remainder = 1

20 ÷ 2, quotient = 10, and remainder = 0

10 ÷ 2, quotient = 5, and remainder = 0

5 ÷ 2, quotient = 2, and remainder = 1

2 ÷ 2, quotient = 1, and remainder = 0

1 ÷ 2, quotient = 0, and remainder = 1

When the quotient is 0, the binary number is obtained by writing the remainders in reverse order (from last to first).

Here, (167)_{10} = (10100111)_{2}.

**For Decimal Fractional Numbers**

Here, we repeatedly divide the integral part of any decimal fraction by 2 until the quotient is 0, while the fractional part is repeatedly multiplied by 2 till we get 0 as the fractional part.

Let us consider the decimal number 15.6875 and transform it into a binary.

**For the Integral Part**

**For the Fractional Part**

On multiplying the fractional part of 15.6875 by 2, we get

0.6875 × 2 = 1.375 = 0.375 + 1

Further, the fractional part of the result (0.375) is multiplied by 2

0.375 × 2 = 0.75 = 0.75 + 0

We repeat the above step until the fractional part is 0.

0.75 × 2 = 1.5 = 0.5 + 1

0.5 × 2 = 1 = 0 + 1

When the fractional part is 0, the binary fractional part is obtained by writing the integrals from first to last. Here, the binary fractional part is 0.1011.

Thus, (15.6875)_{10} = (1111.1011)_{2}

The decimal numbers 0 to 20 and their equivalent binary numbers are in the following table:

Decimal | Binary |
---|---|

0 | 0 |

1 | 1 |

2 | 10 |

3 | 11 |

4 | 100 |

5 | 101 |

6 | 110 |

7 | 111 |

8 | 1000 |

9 | 1001 |

10 | 1010 |

11 | 1011 |

12 | 1100 |

13 | 1101 |

14 | 1110 |

15 | 1111 |

16 | 10000 |

17 | 10001 |

18 | 10010 |

19 | 10011 |

20 | 10100 |

Let us convert the decimal number 167 into a binary using this method.

First, we list the powers of 2 in a table, as shown.

2^{7} = 128 | 2^{6} = 64 | 2^{5} = 32 | 2^{4} = 16 | 2^{3} = 8 | 2^{2} = 4 | 2^{1} = 2 | 2^{0} = 1 |

Now, choosing the largest number that will fit into 167, we get 128.

Thus, we write 1 beneath 128 in the table as the leftmost digit of the binary.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

1 |

Remaining value = 167 – 128 = 39.

Again, by choosing the number that will fit into 39, we get 32.

Thus, we write 0 beneath 64 and 1 beneath 32.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

1 | 0 | 1 |

Remaining value = 39 – 32 = 7.

Similarly, by choosing the number, we get 4 that will fit into 7.

Thus, we write 0 beneath 16, 0 beneath 8, and 1 beneath 4.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

1 | 0 | 1 | 0 | 0 | 1 |

Now, 7 – 4 = 3, which means 2 will fit into 3.

Thus, we write 1 beneath 2.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

1 | 0 | 1 | 0 | 0 | 1 | 1 |

Now, 3 – 2 = 1, which means 1 in the table will fit into 1.

Thus, we finally write:

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

1 | 0 | 1 | 0 | 0 | 1 | 1 | 1 |

Here, we mark a 1 beneath each number that fits into the new value or a 0 beneath each that does not. The final result will be the same from left to right, based on the order of 1 and 0 in the table.

We get (167)_{10} = (10100111)_{2}.

**Convert (31) _{10} into a binary number.**

Solution:

**Find the binary number of the decimal 11.125.**

Solution: