Zamil's CSE Directory

introduction to computer science

How Computers Represent Data

How computers store and process information using binary, bits, and bytes.

#intro#data#binary#bits#systems
intro, data, binary, bits, systems guides

So far in this guide we’ve explored:

  • what computers can do
  • how hardware and software work together
  • what programming is
  • how algorithms solve problems

But this raises an important question:

What exactly are computers working with when they process information?

When you watch a video, send a message, open a photo, or play a game, the computer is handling data.

Surprisingly, all of this information — text, images, music, videos — ultimately becomes the same thing inside the machine:

patterns of 0s and 1s.


Everything Becomes Data

To a computer, almost everything is just data.

Examples include:

Real World ThingData Representation
Text messagesEncoded characters
PhotosPixel values
MusicSound samples
VideosSequences of images and audio
ProgramsInstructions stored as numbers

Even the software that runs on your computer is stored as data.

But why do computers use 0s and 1s?

To answer that, we need to understand how hardware works.


Why Computers Use Binary

Electronic hardware works best when it deals with two clear states.

For example, an electrical circuit can be:

  • On (current flowing)
  • Off (no current)

These two states map perfectly to two numbers:

StateBinary Value
Off0
On1

This system is called binary.

Binary is a base-2 number system, meaning it uses only two digits:


0 and 1

Using just these two symbols, computers can represent any type of information.


Bits — The Smallest Unit of Data

A bit is the smallest unit of data in computing.

The word bit comes from binary digit.

A bit can hold only one value:


0 or 1

By itself, a single bit cannot represent much information.

But when bits are combined together, they become much more powerful.


Bytes — Groups of Bits

Computers usually group bits into sets of eight.

A group of eight bits is called a byte.

Example:


01000001

That sequence is one byte.

With 8 bits, we can represent 256 different values.

Why 256?

Because:


2^8 = 256

This is enough to represent:

  • letters
  • numbers
  • symbols
  • control characters

Which brings us to text.


Representing Text

Computers store text by mapping characters to numbers.

One of the earliest systems for this was ASCII (American Standard Code for Information Interchange).

In ASCII, each character corresponds to a number.

Examples:

CharacterBinary
A01000001
B01000010
C01000011
a01100001
100110001

When you type a message, the computer converts each character into numbers, which are then stored as binary.

Modern systems often use Unicode, which supports thousands of characters from languages around the world.


Representing Numbers

Computers also store numbers in binary.

For example:

DecimalBinary
10001
20010
30011
40100
50101

Binary numbers follow the same logic as decimal numbers, but each position represents a power of 2 instead of a power of 10.

Example:


1011 (binary)

This equals:


1×8 + 0×4 + 1×2 + 1×1 = 11

So:


1011₂ = 11₁₀

Understanding binary is a fundamental concept in computer science.


Representing Images

Images are stored as grids of pixels.

Each pixel has a color value.

For example, a small image might look like this:


■ ■ ■ ■
■ ■ ■ ■
■ ■ ■ ■
■ ■ ■ ■

Each square represents a pixel.

In many systems, colors are stored using three values:

  • Red
  • Green
  • Blue

This is called the RGB color model.

Each color channel often uses 1 byte (8 bits).

Example:

ColorValue
Red255
Green0
Blue0

This produces bright red.

By combining different values, computers can represent millions of colors.


Representing Sound

Sound is stored as samples of audio waves.

Instead of storing the entire sound wave continuously, computers measure the sound at many points in time.

Example:


Wave → sample → sample → sample → sample

Each sample stores a number representing the sound’s amplitude at that moment.

High-quality audio uses:

  • thousands of samples per second
  • multiple bytes per sample

This is how music and voice recordings are stored digitally.


Files Are Just Organized Data

When you save a file on your computer, you are really storing binary data on a storage device.

Examples of files include:

File TypeWhat It Stores
.txttext
.jpgimage data
.mp3audio data
.mp4video data
.exeprogram instructions

Even though these files behave very differently, they are all ultimately sequences of bits stored on hardware.

The operating system and software interpret those bits in different ways.


From Bits to the Digital World

At first glance, it seems unbelievable that 0s and 1s can represent:

  • movies
  • websites
  • games
  • artificial intelligence
  • entire operating systems

But by combining bits in structured ways, computers can represent extremely complex information.

This simple idea — encoding everything as binary — is one of the foundations of modern computing.


The Big Idea

At every level of computing, the same principle appears:

Complex systems emerge from simple building blocks.

In this case, those building blocks are bits.

From just two symbols — 0 and 1 — computers create the entire digital world.

Everything you interact with on a computer — text, photos, music, programs, and websites — ultimately becomes structured patterns of binary data.

Understanding this idea is one of the key mental shifts in computer science:
behind every digital experience is just data being processed by machines.


What Comes Next

Now that we understand how computers represent information, we can zoom back out to the bigger picture.

Modern computing systems combine everything we’ve learned so far:

  • hardware that performs operations
  • software that gives instructions
  • algorithms that solve problems
  • data represented as bits and bytes

These components come together to power the technologies that shape the modern world.

In the next chapter, we’ll explore modern computing and the technology landscape, including:

  • how large software systems are built
  • how computers communicate over networks
  • how cloud computing works
  • and the major fields within computer science today.