# Binary

Binary stands for base 2. It is commonly used in computing for its relative ease of computation and the ease of using ON - OFF states in computers. Binary is written as a number with two different possible digits: 1 and 0.

In computers, each byte usually holds 8 bits, or binary digits. Thus a single byte can hole a value ranging from 0 to 255.

## Converting Binary to Decimal

To convert binary to decimal, take each digit in the binary number which is a 1 and write down the number it represents in decimal. A good way to know what it represents is to start at the far right of the number (this digit is always 1). As you move across each digit to the left you double the number it represents in decimal. Once you've done this, add up all the decimal numbers and the total is your result. Here is an example:

Binary number 1101 =

1 * 2^0 = 1

0 * 2^1 = 0

1 * 2^2 = 4

1 * 2^3 = 8

Add them all together and you get 13.

(Hint: If the far right digit is a 1 then the result should be an odd number, if it is a 0 then it should be an even number. This is because the far right digit is the only one which can be odd, as in any other place the digit will be multiplied by a power of 2 that doesn't equal 1.)

Note that this works because the only two possible digits are 1 and 0. The digit 0 doesn't yield any additional value to a number, so we only have to consider the 1s.