B2 · How Artificial Intelligence Works: Data and Learning

How Computers Store Information

Computers store all information as numbers written in binary, a system that uses only two digits, 0 and 1. Each 0 or 1 is called a bit, and a group of eight bits is a byte. Letters, colours and sounds are all turned into binary numbers.

10 min Beginner Jump to the activity

What you need: Nothing. This page starts from the beginning, with no programming and no formulas.

Definition

How can a computer store a song, a photo and this sentence using only 0 and 1?

Computers store all information as numbers written in binary, a system that uses only two digits, 0 and 1. Each 0 or 1 is called a bit, and a group of eight bits is a byte. Letters, colours and sounds are all turned into binary numbers.

In simple words

Inside a computer are billions of tiny switches that are either off (0) or on (1). With enough switches you can write any number. Then we agree on meanings: the number 65 can mean the letter A, a group of three numbers can mean a colour, and a long list of numbers can mean a song.

Why it matters

AI learns by working with numbers. Knowing that every photo, word and sound becomes numbers explains how a machine can 'see' or 'hear' at all, and why storage is measured in bytes, megabytes and gigabytes.

Key terms

Binary
A number system that uses only two digits, 0 and 1.
Bit
A single binary digit, 0 or 1. It is the smallest unit of information.
Byte
A group of eight bits. One byte can hold 256 different values.
Transistor
A tiny electronic switch inside a chip that is either on or off.
Unicode
The world standard that gives a number to every character of every writing system.
Gigabyte (GB)
About one billion bytes, a common unit for the storage of phones and computers.

Explained in detail

Why only two digits?

A computer chip is made of billions of tiny switches called transistors. Each switch can be in one of two states: on or off. It is easy and reliable for electronics to tell "on" from "off", and much harder to tell ten different levels apart. So computers use a number system with just two digits. On is written as 1 and off as 0. Everything a computer does, from showing a film to running an AI model, comes down to enormous numbers of these switches turning on and off.

Counting in binary

In the everyday number system, each place is worth ten times the place to its right: ones, tens, hundreds. In binary, each place is worth two times the place to its right: ones, twos, fours, eights, sixteens. To read a binary number, add up the values of the places that hold a 1. The binary number 1011 has a 1 in the eights place, a 0 in the fours place, a 1 in the twos place and a 1 in the ones place. Eight and two and one make eleven.

Everyday numberIn binaryHow to read it
10001one
20010two
50101four and one
81000eight
111011eight and two and one
151111eight and four and two and one

An old idea

Binary thinking is much older than electronics. More than two thousand years ago the Indian scholar Pingala described the patterns of short and long syllables in Sanskrit poetry in a way that works like binary counting. In 1703 the German mathematician Gottfried Leibniz published a full account of binary arithmetic. In the 1930s the American engineer Claude Shannon showed that electrical switches could carry out logic using 1s and 0s, and this became the design principle of every digital computer.

How letters become numbers

A computer stores text by giving every character a number. In the oldest common scheme, capital A is 65, B is 66 and so on. That scheme covered only English letters. Today computers use a standard called Unicode, which gives a number to every character in every writing system: Devanagari, Tamil, Bengali, Arabic, Chinese, mathematical symbols and emoji, more than 150,000 characters in all. When you type न on a phone, the phone stores its Unicode number in binary, and any other device in the world can turn that number back into the same letter.

Bits, bytes and beyond

One bit can hold two values. Two bits can hold four, three bits eight, and every extra bit doubles the count. Eight bits, called a byte, can hold 256 different values, enough for one English letter or one shade of a colour. Larger amounts use bigger units, each about a thousand times the one before: a kilobyte is about a thousand bytes, a megabyte about a million, a gigabyte about a billion and a terabyte about a trillion. A page of plain text takes a few kilobytes, a photo a few megabytes, and a film a few gigabytes. Large AI models are trained on collections of data measured in terabytes and more.

How it works

Binary works like the cards in the activity below. Each card is worth double the one to its right: 1, 2, 4, 8, 16. Turn cards face up and add their values to make any number.

UnitSizeRoughly holds
BitOne 0 or 1Yes or no
Byte8 bitsOne letter
Kilobyte (KB)About 1,000 bytesA short message
Megabyte (MB)About 1 million bytesA photo or a song
Gigabyte (GB)About 1 billion bytesA film

Try it yourself

Binary cards

Flip the cards to make each target number. Face up is 1, face down is 0.

Common mistakes

  • Thinking computers understand words directly. Everything is numbers underneath.
  • Mixing up bits and bytes. A byte is eight bits.
  • Thinking binary is a different language for each computer. It's the same 0s and 1s everywhere.

Check yourself

Question 1

1. What does binary use?

Question 2

2. How many bits make a byte?

Question 3

3. With cards worth 16, 8, 4, 2, 1, which cards make 10?

Summary

  • Computers store everything as binary: 0s and 1s.
  • A bit is one 0 or 1; a byte is eight bits.
  • Letters, colours and sounds are all turned into numbers.

Finished reading?

Sources: CS Unplugged: Binary numbers