- Divide by 2: Continuously divide the decimal number by 2 until the quotient is 0.
- Record the remainder: Record the remainder (either 0 or 1) after each division.
- Reverse the order of the remainders: Arrange all the remainders in reverse order of the divisions; this will give you the binary representation of the decimal number.
Example
Let’s convert decimal 19 to binary:
- 19 ÷ 2 = 9, remainder 1
- 9 ÷ 2 = 4, remainder 1
- 4 ÷ 2 = 2, remainder 0
- 2 ÷ 2 = 1, remainder 0
- 1 ÷ 2 = 0, remainder 1
Now, reverse the remainders: 10011, which means the binary representation of 19 is 10011.
This method works for any decimal number!