The following calculator will help you to convert a Decimal number to a Binary number.

In this example, we will convert the **positive integer decimal number** to a binary number.

The following table provides the detail explanation of how to convert decimal (**22**) into binary number (**10110**).

Number | Calculation | Quotient | Remainder |
---|---|---|---|

22 | 22 % 2 | 11 | 0 |

11 | 11 % 2 | 5 | 1 |

5 | 5 % 2 | 2 | 1 |

2 | 2 % 2 | 1 | 0 |

1 | 1 % 2 | 0 | 1 |

**22** (decimal) = **10110** (binary)

**Note**: Read the remainder from bottom to top.

In this example, we will convert the **negative integer decimal number** to a binary number.

The following table provides the detail explanation of how to convert decimal (**-75**) into binary number (**-1001011**).

Number | Calculation | Quotient | Remainder |
---|---|---|---|

75 | 75 % 2 | 37 | 1 |

37 | 37 % 2 | 18 | 1 |

18 | 18 % 2 | 9 | 0 |

9 | 9 % 2 | 4 | 1 |

4 | 4 % 2 | 2 | 0 |

2 | 2 % 2 | 1 | 0 |

1 | 1 % 2 | 0 | 1 |

**-75** (decimal) = **-1001011** (binary)

**Note**: Read the remainder from bottom to top.

**Explanation**: For negative integer decimal to binary number, proceed the steps as same as positive integer decimal to binary number and finally multiply the output by '-1'.

In this example, we will convert the fractional decimal number (**15.125)** to a binary number (**1111.001**).

Here, we have to split the fractional decimal number into two parts.

- Integer part -
**15** - Fraction part -
**0.125**

Now, convert the **Integer part** of the given decimal number (15) into a binary number.

Number | Calculation | Quotient | Remainder |
---|---|---|---|

15 | 15 % 2 | 7 | 1 |

7 | 7 % 2 | 3 | 1 |

3 | 3 % 2 | 1 | 1 |

1 | 1 % 2 | 0 | 1 |

**15** (decimal) = **1111** (binary)

**Note**: Read the remainder from bottom to top.

Now, convert the **Fraction part** of the given decimal number (0.125) into a binary number.

Number | Calculation | Result | Integer |
---|---|---|---|

0.125 | 0.125 × 2 | 0.250 | 0 |

0.250 | 0.250 × 2 | 0.500 | 0 |

0.500 | 0.500 × 2 | 1 | 1 |

**0.125** (decimal) = **001** (binary)

**Note**: Read the Integer from top to bottom.

**Explanation**: Here, you have to stop the table when no more fractional part is available in 'Result' column of table 2. 'Integer' column in table 2 occurs from the integer part of 'Result' column of table 2.

Now, join both the result

C Program to Converter a Decimal to Binary
C++ Program to Converter a Decimal to Binary
C# Program to Converter a Decimal to Binary
Java Program to Converter a Decimal to Binary
PHP Program to Converter a Decimal to Binary
Python Program to Converter a Decimal to Binary