Bytes and Bits

In the computer world, everything is made up of 1s and 0s. These individual 1s and 0s are called “bits.” Collections of bits can be used to represent real numeric values. As you might expect, 1 is 1 and 0 is 0, but where do you go next? Well, this is how we do it:

10 = 2, and 11 = 3. 100 = 4, 101 = 5, and so on. Really, this isn’t a whole lot different than traditional number systems. It’s just another method of counting. Because you only have 1 and 0 to represent numbers with, just like in our decimal system, you add a digit to the end when you run out of space.

“Binary” is the term used to identify this number system. Another name for it is “Base-2” because there are 2 possible values to represent numbers with. Other bases exist too, as long as there’s a large enough number of symbols to represent them with. Here’s an excellent video that explains how different “bases” work:

For me, watching this guy’s videos is like going down a rabbit hole — they’re SOOO interesting

Technically speaking, a computer could use different number systems. However, they were unreliable due to issues with physics and electrical current, as discussed here:

another INCREDIBLE series for learning about this sort of thing. I highly recommend it if you’re interested in this stuff. It teaches in 41 episodes more than I could with my current skillset in a year.

So, we’re stuck with binary. That’s not a huge issue though, for there’s already a branch of mathematics that deals with this exact idea — and it’s called boolean algebra. But, for the moment that’s not necessary to understand — we’ll just be focused on the storage of data itself and how that can be represented. If you want to learn how it works, watch the rest of the crash course video linked above.

In terms of data storage and data interpretation, 8 bits together create a “byte.” As such, one byte can have up to 255 different values associated with it and can be represented in “Hexadecimal.” Hexadecimal is Base-16 and uses the values 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F to represent different numbers. After we run out of room with traditional digits, we expand into the capital letters A through F .

You might think it sounds complicated to translate a byte into a hexadecimal value, but in reality it’s a lot easier than it sounds. 10011100 for instance would be 9C in hex. The conversion is done by taking each “nibble” (half of a byte), getting the hexadecimal value for each one, and putting them back together. This way, instead of trying to process the entire binary number and converting that to hex, you only need to worry about values 0 through 15 (the max value that a nibble can have). Therefor, the process looks something like: 1001 (9 => 9), 1100 (12 => C) which gives us 9C .

Bytes are traditionally the smallest method of storage a computer does. To extract smaller values, one needs to rely on this boolean algebra. This will be covered when we encounter an instance where this needs to be done, but for now if you’re interested check out the crash course video linked above.