# Converting Decimals to Binaries

The binary number system (which is composed of 0's and 1's) is predominantly used in the logic operations processed by computers. Therefore, the conversion rules from decimal number system to binary number system are of primary importance in digital electronics. In this post, we summarize how to convert a decimal number (whole or fractional) to a binary number. This is also a fun activity that you can carry out with your kids.

First we focus on how to convert a whole decimal number to a binary number. In binary system (base 2), each digit corresponds to a power of 2, as opposed to 10 which is the case for the decimal system (or base 10). Thus, the very first digit is assigned to "2 to the power 0", the second digit is to "2 to the power 1", and so for and so forth. As a simple example, a whole decimal number **5** = **1 **x (2^2) + **0 **x (2^1) + **1 **x (2^0) is written as **101** in binary number system. Below shows a more systematic way to convert a whole decimal number to its binary counterpart.

Now, the question arises on how to deal with the fractions. Similar to the decimal system, the digits after the binary point the digits are reserved for the negative powers of 2. So, the first digit after the binary point corresponds to the "2 to the power -1" digit, and the second digit after the binary point to the "2 to the power -2" , and so for and so forth. As an example, the number **0.101** in binary system is simply given as **1** x (2^-1) + **0** x (2^-2) + **1** x (2^-3) = **0.625** in decimal number system. In the below article, we present a more systematic way to convert decimal fractions to binary decimals.

#mathematics #binary #engineering