Decimal to Binary
To Convert a decimal number to a binary number follows a straightforward method.
It involves dividing the number to be converted, say N, by 2 (since binary is in base 2), and making note of the remainder. We continue dividing the quotient (N / 2) by 2, until we reach the division of (1 / 2), also making note of all remainders.
Example 1: Convert 98 from decimal to binary.
1) Divide 98 by 2, making note of the remainder. Continue dividing quotients by 2, making note of the remainders. Also note the star (*) beside the last remainder.
Division | Remainder,R |
98 / 2 = 49 | 0 |
49 / 2 = 24 | 1 |
24 / 2 = 12 | 0 |
12 / 2 = 6 | 0 |
6 / 2 = 3 | 0 |
3 / 2 = 1 | 1 |
1 / 2 = 0 | 1* |
2) The sequence of remainders going up gives the answer. Starting from 1*, we have 1100010. Therefore, 98 in decimal is 1100010 in binary.
Example 2: Convert 21 into binary.
Division | Remainder,R |
21 / 2 = 10 | 1 |
10 / 2 = 5 | 0 |
5 / 2 = 2 | 1 |
2 / 2 = 1 | 0 |
1 / 2 = 0 | 1* |
Therefore, 21 in decimal is 10101 in binary
Binary to Decimal
Now, how to convert from binary to decimal number. Binary to decimal conversion follows the same steps as decimal to binary, except in reverse order. We begin by multiplying 0 x 2 and adding 1. We continue to multiply the numbers in the "results" column by 2, and adding the digits from left to right in our binary number.
Example 1: Convert 11101 from binary to decimal.
Operation | Result |
0 x 2 + 1 | 1 |
1 x 2 + 1 | 3 |
3 x 2 + 1 | 7 |
7 x 2 + 0 | 14 |
14 x 2 + 1 | 29 |
Therefore, 11101 in binary is 29 in decimal.