CS Fundamentals
Master the binary number system — how to read, write, and convert binary numbers. Learn why binary is the language of all computers.
Introduction
Binary is the native language of every computer ever built. Every photo on your phone, every video you stream, every message you send — all stored and processed as sequences of 0s and 1s. Understanding binary isn't just academic; it's understanding how computers "think" at the most fundamental level.
What Is Binary?
Binary is a base-2 number system that uses only two digits: 0 and 1. Each digit is called a bit (binary digit). Despite using just two symbols, binary can represent any number, text, image, or data that decimal can — just with more digits.
Counting in Binary
In decimal, when you reach 9, you roll over to 10. In binary, when you reach 1, you roll over to 10 (which represents TWO, not ten):
| Decimal | Binary | Explanation |
|---|---|---|
| 0 | 0 | Zero |
| 1 | 1 | One |
| 2 | 10 | One-two plus zero-ones |
| 3 | 11 | One-two plus one-one |
| 4 | 100 | One-four, zero-twos, zero-ones |
| 5 | 101 | One-four, zero-twos, one-one |
| 6 | 110 | One-four, one-two, zero-ones |
| 7 | 111 | One-four, one-two, one-one |
| 8 | 1000 | One-eight |
| 9 | 1001 | One-eight plus one-one |
| 10 | 1010 | One-eight plus one-two |
| 15 | 1111 | 8+4+2+1 |
| 16 | 10000 | One-sixteen |
Place Values in Binary
Just like decimal has ones, tens, hundreds places, binary has place values that are powers of 2:
| Position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
To convert binary to decimal, multiply each bit by its place value and add:
Example: 10110101₂ = 1×128 + 0×64 + 1×32 + 1×16 + 0×8 + 1×4 + 0×2 + 1×1 = 128 + 0 + 32 + 16 + 0 + 4 + 0 + 1 = 181₁₀
Converting Decimal to Binary
Use repeated division by 2:
Convert 45 to binary:
45 ÷ 2 = 22 remainder 1 22 ÷ 2 = 11 remainder 0 11 ÷ 2 = 5 remainder 1 5 ÷ 2 = 2 remainder 1 2 ÷ 2 = 1 remainder 0 1 ÷ 2 = 0 remainder 1
Read remainders bottom-to-top: 45₁₀ = 101101₂
Verify: 32 + 0 + 8 + 4 + 0 + 1 = 45 ✓
Bits, Bytes, and Beyond
- Bit — A single binary digit (0 or 1). The smallest unit of data.
- Nibble — 4 bits (can represent 0–15, or one hexadecimal digit)
- Byte — 8 bits (can represent 0–255). The fundamental unit of computer storage.
- Kilobyte (KB) — 1,024 bytes
- Megabyte (MB) — 1,024 KB (~1 million bytes)
- Gigabyte (GB) — 1,024 MB (~1 billion bytes)
Why 8 bits = 1 byte?
With 8 bits, you can represent 2⁸ = 256 different values (0–255). This is enough to represent:
- Any English character (A-Z, a-z, 0-9, symbols)
- A single color channel (red, green, or blue intensity)
- A small number for many computational purposes
How Computers Use Binary Internally
Everything in a computer is binary. Here's how different data types are stored:
Numbers: Directly as binary values
- The number 42 is stored as
00101010
Text: Each character gets a numeric code (ASCII/Unicode), stored in binary
- The letter 'A' = 65 =
01000001 - The letter 'B' = 66 =
01000010
Colors: Three numbers (Red, Green, Blue) each 0–255
- Red = (255, 0, 0) =
11111111 00000000 00000000 - White = (255, 255, 255) = all 1s
Images: Millions of pixels, each with RGB color values — all binary
Sound: Thousands of amplitude samples per second, each stored as binary numbers
Practice Problems
Try these conversions yourself:
- Convert 13₁₀ to binary (Answer: 1101)
- Convert 11010₂ to decimal (Answer: 26)
- Convert 100₁₀ to binary (Answer: 1100100)
- Convert 11111111₂ to decimal (Answer: 255)
- How many different values can 4 bits represent? (Answer: 16, from 0 to 15)
Key Takeaways
- Binary uses only 0 and 1 — matching computer hardware's two states (on/off)
- Place values are powers of 2: 1, 2, 4, 8, 16, 32, 64, 128...
- Convert binary→decimal by adding place values where bits are 1
- Convert decimal→binary by repeated division by 2
- 8 bits make 1 byte, which can represent 256 different values
- ALL computer data — text, images, sound, video — is ultimately stored in binary
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Binary Number System — Computer Fundamentals.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Computer Fundamentals topic.
Search Terms
computer-fundamentals, computer fundamentals, computer, fundamentals, data, representation, binary, number
Related Computer Fundamentals Topics