# 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 20, the second 21, 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 `1011110102` to decimal:

`1011110102 = 1×28+0×27+1×26+1×25+1×24+1×23+0×22+1×21+0×20`

Thus, `1011110102 = 37810`