In this tutorial we will learn to convert a decimal number into binary number.

Before we dive into the main topic lets talk a little about Decimal and Binary Number System that we are going to work with in this tutorial.

A decimal number system consists of 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. So, any number that we use in our daily life is actually in decimal number system.

A binary number system consists of only 2 digits: 0 and 1. And it is most commmonly used in computers.

To convert a decimal number into binary we divide the number by 2 till the dividend becomes less than 2.

Convert decimal number 10 into binary form.

So, our dividend is 10 and as we are finding binary of 10 so we will divide it by 2. Thus, the divisor is 2.

```
Step 1
----------------
Dividend = 10
Divisor = 2
Quotient = 5
2 ) 10 ( 5
10
----
0
Dividing 10 by 2 we will get 0 as remainder.
So, 1st remainder = 0
Dividend for step 2 = quotient of step 1
So, dividend for step 2 = 5
Step 2
----------------
Dividend = 5
Divisor = 2
Quotient = 2
2 ) 5 ( 2
4
----
1
Dividing 5 by 2 we will get 1 as remainder.
So, 2nd remainder = 1
Dividend for step 3 = quotient of step 2
So, dividend for step 3 = 2
Step 3
----------------
Dividend = 2
Divisor = 2
Quotient = 1
2 ) 2 ( 1
2
----
0
Dividing 2 by 2 we will get 0 as remainder.
So, 3rd remainder = 0
Dividend for step 4 = quotient of step 3
So, dividend for step 4 = 1
Step 4
-----------------
Dividend = 1
As, dividend is less than 2 so, we will stop here and copy the dividend as the last remainder.
So, 4th remaider = 1
```

The calculated remainder are as followed.

1st remainder = 0

2nd remainder = 1

3rd remainder = 0

4th remainder = 1

To find the binary we have to scan the remainder from bottom.

So, 10_{(base 10)} = 1010_{(base 2)}

Alternatively, (10)_{10} = (1010)_{2}

Where, (base 10) means the number is in decimal number system and (base 2) means the number is in binary number system.

Convert decimal number 120 into binary form.

So, our dividend is 120 and the divisor is 2.

```
Step 1
----------------
Dividend = 120
Divisor = 2
Quotient = 60
2 ) 120 ( 60
120
-----
0
Dividing 120 by 2 we will get 0 as remainder.
So, 1st remainder = 0
Dividend for step 2 = quotient of step 1
So, dividend for step 2 = 60
Step 2
----------------
Dividend = 60
Divisor = 2
Quotient = 30
2 ) 60 ( 30
60
----
0
Dividing 60 by 2 we will get 0 as remainder.
So, 2nd remainder = 0
Dividend for step 3 = quotient of step 2
So, dividend for step 3 = 30
Step 3
----------------
Dividend = 30
Divisor = 2
Quotient = 15
2 ) 30 ( 15
30
----
0
Dividing 30 by 2 we will get 0 as remainder.
So, 2nd remainder = 0
Dividend for step 4 = quotient of step 3
So, dividend for step 4 = 15
Step 4
----------------
Dividend = 15
Divisor = 2
Quotient = 7
2 ) 15 ( 7
14
----
1
Dividing 15 by 2 we will get 1 as remainder.
So, 4th remainder = 1
Dividend for step 5 = quotient of step 4
So, dividend for step 5 = 7
Step 5
-----------------
Dividend = 7
Divisor = 2
Quotient = 3
2 ) 7 ( 3
6
----
1
Dividing 7 by 2 we will get 1 as remainder.
So, 4th remainder = 1
Dividend for step 6 = quotient of step 5
So, dividend for step 6 = 3
Step 6
------------------
Dividend = 3
Divisor = 2
Quotient = 1
2 ) 3 ( 1
2
----
1
Dividing 3 by 2 we will get 1 as remainder.
So, 5th remainder = 1
Dividend for step 7 = quotient of step 6
So, dividend for step 7 = 1
Step 7
-------------------
Dividend = 1
As, dividend is less than 2 so, we will stop here and copy the dividend as the last remainder.
So, 7th remaider = 1
```

The calculated remainder are as followed.

1st remainder = 0

2nd remainder = 0

3rd remainder = 0

4th remainder = 1

5th remainder = 1

6th remainder = 1

7th remainder = 1

To find the binary we have to scan the remainder from bottom.

So, 120_{(base 10)} = 1111000_{(base 2)}

Alternatively, (120)_{10} = (1111000)_{2}

Recently Added

- JS Event Handlers JavaScript
- JS Conditional Statement - Switch JavaScript
- JS Conditional Statement - If Else JavaScript
- JS Objects JavaScript
- JS Functions JavaScript
- JS Logical Operators JavaScript
- JS Comparison Operators JavaScript
- JS Assignment Operator JavaScript
- Bootstrap - Responsive Embed and Wells Bootstrap
- Bootstrap - Breadcrumbs, Jumbotron and Page Header Bootstrap