Decimal Numbers System
The easiest way to understand bits is to compare them to something you know: digits. A digit is a single place that can hold numerical values between 0 and 9. Digits are normally combined together in groups to create larger numbers. For example, ‘4,378’ has four digits. It is understood that in the number ‘4,378’ the ‘8’ is filling the “1s place,” while the ‘7’ is filling the “10s place,” the ‘3’ is filling the “100s place”, and the ‘4’ is filling the “1,000s place”. So you could express things this way if you wanted to be explicit:
Another way to express it would be to use powers of 10. Assuming that we are going to represent the concept of “raised to the power of” with the “^” symbol (so “10 squared” is written as “10^2“), another way to express it is like this:
What you can see from this expression is that each digit is a placeholder for the next higher power of 10, starting in the first digit with 10 raised to the power of zero.
Binary Number System
Computers happen to operate using the base-2 number system, also known as the binary number system and therefore use binary digits in place of decimal digits. The word bit is a shortening of the words “Binary digit.” Whereas decimal digits have 10 possible values ranging from 0 to 9, bits have only two possible values: 0 and 1. Therefore, a binary number is composed of only 0s and 1s, like this: 1110. How do you figure out what the value of the binary number 1110 is? You do it in the same way we did it above for 4378, but you use a base of 2 instead of a base of 10. So:
You can see that in binary numbers, each bit holds the value of increasing powers of 2. That makes counting in binary pretty easy. Starting at 0 and going through 21, counting in decimal and binary looks like this :
When you look at this sequence, 0 and 1 are the same for decimal and binary number systems. At the number 2, you see carrying first take place in the binary system. If a bit is 1, and you add 1 to it, the bit becomes 0 and the next bit becomes 1. In the transition from 15 to 16 this effect rolls over through 4 bits, turning 1111 into 10000. Bits are rarely seen alone in computers. They are almost always bundled together into 8-bit collections, and these collections are called bytes. With 8 bits in a byte, you can represent 256 values ranging from 0 to 255.