Bits, Bytes and Memory Sizes

Bits, Bytes and Memory Sizes: How Computers Work lesson banner with Beep and Pixel

Track: How Computers Work  ·  Lesson 7 of 10  ·  Ages: 8+  ·  Time: 30 minutes

Have you ever seen a message like “Your phone is almost full” or “This game is 2 GB”? What do those letters mean? Today you will learn the names for computer sizes and get a feel for how big they really are.

Beep says I like batteries, but I like tidy sizes even more. Everything in a computer is measured in bits and bytes. Beep boop!

What you need

  • Paper and a pencil.
  • A grown-up and a computer or tablet, for the size detective activity.
  • About 30 minutes.

From bit to byte

You already know the smallest piece of computer information. A bit is a single 0 or 1, one bulb that is either off or on.

A group of 8 bits is called a byte. Remember the letter A? It was 01000001, eight bits, so one byte. In plain English text, one letter, digit or space takes one byte. A short word like “hello” takes 5 bytes.

How many different patterns can one byte hold? Each of the 8 bulbs has 2 choices, so the total is 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 = 256. That matches 0 to 255 from the bulbs lesson.

Bigger and bigger

One byte is tiny. To talk about bigger amounts we use the same helpers you meet in other units, like kilo in kilometre, which means a thousand metres.

NameShortRoughly how many bytes
ByteB1
KilobyteKB1,000
MegabyteMB1,000,000 (a thousand kilobytes)
GigabyteGB1,000,000,000 (a thousand megabytes)
TerabyteTB1,000,000,000,000 (a thousand gigabytes)

Each step up is a thousand times bigger than the one before.

Pixel says One thousand, one million, one billion, one trillion. The names are like a staircase, and every step is a thousand times taller. Meow!

A note on 1,000 and 1,024

You may hear that a kilobyte is 1,024 bytes, not 1,000. Both are used, which can be confusing! Here is why.

Computers love powers of two, the numbers you get by doubling: 2, 4, 8, 16… If you keep doubling ten times you reach 1,024, which is very close to 1,000. So early on, people used 1,024 for a kilobyte. Today, hard drive and phone makers use 1,000, and this lesson does too. Some programs still count in 1,024. That is why a drive sold as “500 GB” can show a slightly smaller number on some computers.

There are even special names for the 1,024 versions, like kibibyte, but you do not need to remember them. The sizes are close enough that this lesson’s rough guesses work either way.

How big is it?

Here are some rough sizes. They vary a lot, so treat them as guesses.

ThingRough size
A short text message100 bytes
A page of a storya few KB
A photo from a phonea few MB
A songa few MB
A gamea few GB or more
A whole filmone to several GB
A phone’s storage64 to 256 GB is common
A big computer drive1 TB or more

Photos and videos are large because they have lots of pixels, each with three bytes of colour. Text is small, because each letter needs only one byte.

Let Python do the sums

print("1 byte =", 8, "bits")
print("1 byte can make", 2 ** 8, "different patterns")
print("5 letters need", len("hello"), "bytes")
names = ["kilobyte", "megabyte", "gigabyte", "terabyte"]
size = 1
for name in names:
    size = size * 1000
    print("1", name, "=", size, "bytes")
print(2 ** 10)
1 byte = 8 bits
1 byte can make 256 different patterns
5 letters need 5 bytes
1 kilobyte = 1000 bytes
1 megabyte = 1000000 bytes
1 gigabyte = 1000000000 bytes
1 terabyte = 1000000000000 bytes
1024

The symbols 2 ** 8 mean “2 to the power of 8”, which is 2 multiplied by itself 8 times. The loop starts with 1 and multiplies by 1000 each time round. The last line shows what happens when you double ten times: 1,024.

Now let us see how many photos fit on a phone. Say each photo is 4 MB and the phone holds 64 GB:

phone_storage = 64 * 1000 * 1000 * 1000
photo_size = 4 * 1000 * 1000
print(phone_storage // photo_size)
16000

The // sign divides and gives a whole number. Sixteen thousand photos fit! Of course a phone also stores apps and videos, so in real life there is less room.

Did you know? The first hard drive, made in 1956, was about as big as two fridges and held only a few megabytes. Today a tiny memory card the size of a fingernail can hold thousands of times more.

Size detective

Try it Ask a grown-up to show you how to see how big a file or photo is on a computer or tablet. Pick three files. Are they in KB, MB or GB? Which one is biggest? Is it a photo, a video or a text document?

Try it How many bits are in 3 bytes? And how many letters of plain text could roughly fit in 1 kilobyte?

Show the answer

3 bytes is 3 × 8 = 24 bits. One kilobyte is about 1,000 bytes, so roughly 1,000 letters fit, about as much as a few paragraphs of a story.

Try it Change the photo program so that each photo is 2 MB. How many fit now? Try it before you run it!

Show the answer

Halving the photo size doubles the number that fit, so you get 32000. Change the second line to photo_size = 2 * 1000 * 1000.

Grown-ups Children are often puzzled when a “full” phone refuses to take another photo. Help them find where storage is shown on a device and what takes up the most space. Both 1,000 and 1,024 conventions are in everyday use, so a small mismatch between a label and what a device reports is normal, not a fault.

What you learned

  • A bit is one 0 or 1, and a byte is 8 bits.
  • One byte can hold 256 different patterns, enough for one letter.
  • Kilobyte, megabyte, gigabyte and terabyte are each about a thousand times bigger than the one before.
  • Some programs use 1,024 instead of 1,000, because 1,024 is 2 doubled ten times.
  • Text is small, but photos and videos are big.