# Binary to Decimal Converter

## Converting Binary to Decimal

Binary is the most basic language of computers. Everything, from simple text to full-length movies can be exepressed using binary. Computers use binary because it is a base 2 numbering system, in which each digit value has a value of one or zero. Thanks to the invention of the transistor, computers can represent binary numbers at an electronics level. Simple operations are implemented on the CPU and use binary values to compute.

Unless you are a computer, chances are good that you don't think in binary. We need a way to convert from binary to decimal and back again. Fortunately, the process for converting binary to decimal (base 10) is pretty simple!

Each binary digit corresponds to a power of two, in ascending order. The first digit is 2^{0}, the second 2^{1}, and so on. If the corresponding binary digit has a value of one, add the power of two to your final result. Continue to the left until you have no more digits left.

### Example

Converting `101111010`_{2}

to decimal:

`101111010`_{2} = 1×2^{8}+0×2^{7}+1×2^{6}+1×2^{5}+1×2^{4}+1×2^{3}+0×2^{2}+1×2^{1}+0×2^{0}

Thus, `101111010`_{2} = 378_{10}