Decimal to Binary

The numeric system that we use in general is known as the Decimal System. The decimal system uses 10 as its base. The number 10 is used as the base, since any given number is a combination of digits ranging from 0 to 9 (10 digits). The value of the digits is assigned as per their relative position in the number. This place value increases in the multiples of 10 as we go from right hand side towards the left. Hence, every digit can be represented as a multiple of 10 with an appropriate power. As a general rule, any number with the power of 0 is always 1. For example, the number 5269 can be represented as:

(5×103) + (2×102) + (6×101) + (9×100) = 5269

As we can see in the above example, each digit is multiplied by 10 and assigned an appropriate power according to its position in the number which increases as we go from right towards left.

As the base is 10 for Decimal Numbers, similarly the base is 2 for the Binary system. The Binary system uses only ‘1′ or ‘0′ to represent all numbers. Since we use only ‘1′ and ‘0′ (two digits), 2 acts as the base for binary numbers. The concept of place value in the binary system is very similar to that of Decimal system. The place value of digits in a number increases as we go from right towards left. The value of each digit is twice that of its previous digit but is represented only by ‘1′ or ‘0′.

Let us consider the following illustration:

Decimal Digit Value2561286432168421
Binary Digit Value101001001

We don’t need to consider the values represented by 0. We will only add up the values represented by 1. So, the equation is:

256 + 64 + 8 + 1 = 32910

From the above illustration, we understand that the number 1010010012(binary number) is equivalent to 32910 in the decimal system. When binary number system is used in computers or the digital system, ‘1′ represents ‘ON’ and ‘0′ represents ‘OFF’.

Let us consider the following example where the decimal number 240 is converted into its binary number equivalent.

Number240Whenever a number is Divided by “2″, a result and a remainder are derived. MSB represents the most significant bit and LSB represents least significant bit. The binary number is derived going forward from MSB towards LSB.
divide by 2
result120remainder0 (LSB)
divide by 2
result60remainder0
divide by 2
result30remainder0
divide by 2
result15remainder0
divide by 2
result7remainder1
divide by 2
result3remainder1
divide by 2
result1remainder1
divide by 2
result0remainder1 (MSB)

So, when we move from MSB towards LSB i.e. from bottom to upwards, the binary number formed is 11110000. The binary number 111100002 is equivalent to the 24010 decimal number.