# Decimal Number Representation in Binary ( Binary to Decimal Explanation )

##### Decimal Number Representation in Binary ( Binary to Decimal Explanation ):

Binary means base-2 number system. There are only two symbols 0 ( Zero ) and 1 ( One ). Each Binary Digit is called bit. Calculating decimal equivalent of binary number is easy. Index is always from bit Count Minus One to Zero.

We start raising two to the power 0 from the right most bit and increment for each left bit. Another way is we start from right raising two to the power of bit length – 1 and decrement for every right bit.

Our base is two. Whenever we find a 1 in binary number we raise its index to power of 2 and sum all those numbers. See example below,

5 in 3 bit binary is, 101

```0  1  0  1
23 22 21 20
0  4  0  1   /* summing these gives us 5 */
```

54 in 6 bit binary is, 110110

```1   1   0   1  1  0
25  24  23  22  21 20
32  16  0   4  2  0   /* summing these gives 54 */
```

###### Extras,

Bit pattern count = 2bit
8 bit = 1 Byte

Byte is represented by Capital B while bit is represented by small b.
MB = Megabyte
Mb = Megabit