Binary & Data
Understanding how computers represent everything using just 1s and 0s
Introduction
Imagine trying to write a letter using only two symbols — a dot and a dash. That sounds impossible, right? Yet every photo, video, song, game, and document on your computer is built from just two numbers: 0 and 1.
This is the secret language of computers: binary. Inside every computer, billions of tiny switches flip between on (1) and off (0) at incredible speeds, combining these simple signals into complex information. When you type a letter, send a message, or watch a video, you are witnessing binary in action.
In this chapter, you will discover how computers use binary to represent numbers, text, images, and sound — and why this simple system is the foundation of all modern computing.
How It Works
Imagine a light switch. It can only be in one of two positions: up (on) or down (off). Now imagine having billions of these switches inside your computer. By flipping different combinations of switches, your computer can create numbers, letters, pictures, and sounds. One switch = one bit, the smallest piece of information a computer can use.
Household Object Analogy
Think of binary like a row of light switches on a wall. Each switch can be on or off. If you have 8 switches, you can create 256 different patterns — enough to represent every letter on a keyboard. Computers use this exact idea but with electronic switches called transistors.
Deeper Dive
A bit (short for binary digit) is the fundamental unit of data in computing. A group of 8 bits is called a byte. One byte can store a single character, like the letter 'A' or the number '5'. The table below shows how binary counting works compared to our everyday decimal system.
| Decimal | Binary | Explanation |
|---|---|---|
| 0 | 0 | All switches off |
| 1 | 1 | One switch on |
| 2 | 10 | Flip the next switch, turn first off |
| 3 | 11 | Two switches on |
| 4 | 100 | Flip the third switch |
| 8 | 1000 | Each position doubles in value |
| 255 | 11111111 | All 8 switches on — the maximum value in one byte |
To represent text, computers use standards like ASCII (American Standard Code for Information Interchange) or Unicode. Each character is assigned a unique binary pattern. For example, the letter 'A' is 01000001 in binary (decimal 65).
How Images Work in Binary
Images are made of tiny dots called pixels. Each pixel stores its color as a binary number. A typical image uses 24 bits per pixel — 8 bits for red, 8 for green, and 8 for blue. With 8 bits per channel, you get 256 shades of each color, creating over 16 million possible colors.
Advanced
Binary arithmetic forms the foundation of all computer operations. The CPU uses the two's complement system to represent negative numbers, allowing subtraction to be performed using addition circuits. Floating-point numbers follow the IEEE 754 standard, which splits bits between a sign, exponent, and mantissa to represent a vast range of values with varying precision.
Data compression algorithms like Huffman coding and LZW (Lempel-Ziv-Welch) exploit patterns in binary data to reduce file sizes without losing information. Encoding schemes such as Base64 convert binary data into text characters for safe transmission over protocols that only support text.
Data sizes scale up quickly: a kilobyte (KB) is roughly 1,024 bytes, a megabyte (MB) about 1 million bytes, a gigabyte (GB) about 1 billion bytes, and a terabyte (TB) about 1 trillion bytes. Modern hard drives hold terabytes of data — trillions of bits all stored as magnetic or electronic on/off states.
Vocabulary Table
| Term | Definition |
|---|---|
| Bit | The smallest unit of data in computing, either a 0 or 1 |
| Byte | A group of 8 bits, enough to store one character |
| Binary | A number system that uses only two digits: 0 and 1 |
| Decimal | The base-10 number system humans use, with digits 0–9 |
| Transistor | A tiny electronic switch that can be on or off, used to store bits |
| ASCII | A standard that maps characters to binary numbers (7 or 8 bits each) |
| Unicode | An expanded standard supporting characters from all world languages |
| Pixel | The smallest unit of a digital image, storing color as binary |
| Kilobyte (KB) | Approximately 1,024 bytes (210 bytes) |
| Megabyte (MB) | Approximately 1,048,576 bytes (220 bytes) |
Fun Facts
The word "bit" is a combination of "binary" and "digit". It was coined by statistician John Tukey in 1946.
A typical modern CPU contains billions of transistors. Apple's M3 Ultra chip has over 184 billion transistors.
If you wrote out the number 255 in binary (11111111) using one light bulb per bit, you would need exactly 8 bulbs.
The 0s and 1s in your computer are represented by electricity. A higher voltage (~5V) means 1, and a lower voltage (~0V) means 0.
The entire text of the Bible is about 5 MB. With 1 GB, you could store over 200 Bibles. A 1 TB drive holds roughly 200,000 Bibles.
Interactive Diagram
Launch the interactive diagram to see this in action.
Open Interactive DiagramThe interactive diagram for this chapter demonstrates Binary and Data Representation. It shows a visual of binary digits (0s and 1s) being converted into text, numbers, and images.
What to explore:
- click a letter or number; watch it convert to its binary representation; toggle different data types to see how they are encoded
- all data in a computer is ultimately stored as binary — combinations of 0s and 1s that represent text, numbers, images, and more
Knowledge Check
1. What is a bit?
Answer: The smallest unit of data, either a 0 or 1
2. How many bits are in a byte?
Answer: 8
3. What standard is commonly used to represent characters as binary numbers?
Answer: ASCII
