Portmint Lighthouse

Bits and Bytes: The Alphabet of a Computer

Here's the plain idea: a computer can't store words or pictures directly. Underneath everything it does, it only ever keeps track of one kind of thing — a switch that is either on or off. Every file you've ever owned is, at the bottom, a vast pile of those switches.

The row of light switches

Picture a long wall covered in light switches, each one either up or down. That's all a computer really has inside. One switch can only say one of two things — up or down, yes or no — so on its own it's almost useless.

But line up eight switches and suddenly you have 256 different up-and-down patterns you can make. Line up more and the number of patterns explodes. The trick of a computer isn't any single switch. It's that there are billions of them, and we've agreed what each pattern means.

Naming the pieces

A single switch — one on-or-off, one yes-or-no — is called a bit. It's the smallest scrap of information there is. You can't cut it smaller.

Eight bits bundled together is called a byte. A byte has enough patterns (256 of them) to stand for a single letter, a digit, or a punctuation mark. So the letter "A" is one byte; the word "Ahoy" is four. When you hear "byte," picture one character on a page.

How a picture hides in there

If a computer only knows yes-and-no, how does it hold a photo? The same way — just more of it.

A photo is a grid of tiny colored dots called pixels. For each dot, the computer stores a few numbers describing its color: how much red, green, and blue. Each of those numbers is written in bits. So a photo is simply a very long list of "this dot is this color," and every color is, underneath, more switches flipped up or down.

A song works the same trick. Sound is measured thousands of times a second, each measurement written as a number, each number as bits. Nothing about a computer is fancier than this. It is bits, all the way down.

Kilobytes, megabytes, gigabytes

Because bytes are tiny, we count them in big bundles. A thousand-ish bytes is a kilobyte. A million-ish is a megabyte. A billion-ish is a gigabyte. So a phone with "128 gigabytes" of room can hold about 128 billion characters' worth of switches — which is why it fits so many photos.

These words aren't mysterious units. They're just "small pile," "medium pile," and "big pile" of the same yes-or-no switches.

Your turn

Look at a file on your device and find its size — something like "2.4 MB." Say it out loud as "about two and a half million bytes," then "about two and a half million characters' worth of switches." That number is real, physical storage being used.

🔦 Next we'll meet the one part of the computer whose whole job is to flip and read these switches in a sensible order: the CPU, the chip that thinks.

Stuck or curious?

Ask Pip about this lesson — tap the porthole bottom-right.