# Lesson : Binary to Decimal

When working with binary number, you will often have to convert binary number to decimal number. There is not multiples ways of converting a binary number to a decimal number. Each digits has a weight (or value if you prefer) as seen in previous lessons. You will need to add together the weight value of each digits in the binary number with a value of “1” to get the decimal value. From previous lessons, we have the figure below which shows the place value of the seven first digits : Figure 1 : Weights of the first 7 digits of the binary numeral system

The weight value of each digits is 2 exponents its position minus 1 (like shown below on Figure 2). The first digit on the right is in position 1 which means it is worth 2 exponent 0 since it is position 1 minus 1 which gives us 0. The last digit on the left is in the seventh position which means its weight is 2 exponent 6 or (7 – 1). The first digit position is always on the right for a binary integer. The weight of this first digit of an integer binary number will always be 1. Do note, a digit always has a weight value that is worth two times the one on its right. Figure 2 : Weights of the first 7 digits of the binary numeral system

So for example, if we have the binary number “1001”. To calculate the decimal value of this binary number, we need to add together the weight of each digits that is a “1” in the binary number. $\textbf{1} \cdot 2^{3} + \textbf{0} \cdot 2^{2} + \textbf{0} \cdot 2^{1} + \textbf{1} \cdot 2^{0} = 8 + 1 = 9$

This binary number is the decimal number “9”.

### Example 1 :

We have the binary number “110101” that we want to convert to a decimal number. We need to add together the weight of each digits that is a “1” in the binary number. $\textbf{1} \cdot 2^{5} + \textbf{1} \cdot 2^{4} + \textbf{0} \cdot 2^{3} + \textbf{1} \cdot 2^{2} + \textbf{0} \cdot 2^{1} + \textbf{1} \cdot 2^{0}$ $32 + 16 + 4 + 1 = 53$

This binary number is the decimal number “53”.

### Example 2 :

We have the binary number “11101” that we want to convert to a decimal number. We need to add together the weight of each digits that is a “1” in the binary number. $\textbf{1} \cdot 2^{4} + \textbf{1} \cdot 2^{3} + \textbf{1} \cdot 2^{2} + \textbf{0} \cdot 2^{1} + \textbf{1} \cdot 2^{0}$ $16 + 8 + 4 + 1 = 29$