Binary Explained- Understanding Binary Code Basics
What Binary Actually Is
Binary is a number system with only two digits: 0 and 1. That's it. Nothing fancy. Your computer runs on this because electricity has two states: on or off. So everything your computer does—every image, video, text message—comes down to millions of tiny switches flipping between 0 and 1.
You use decimal every day. It has ten digits (0-9). Binary works the same way, just with fewer options. Each position in a binary number represents a power of 2, not 10.
How Binary Numbers Work
Take the binary number 1010. Here's what each position means:
- Rightmost 0 = 0 × 2⁰ = 0
- Next 1 = 1 × 2¹ = 2
- Next 0 = 0 × 2² = 0
- Leftmost 1 = 1 × 2³ = 8
Total: 8 + 0 + 2 + 0 = 10 in decimal.
Common decimal to binary conversions you should know:
| Decimal | Binary |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 2 | 10 |
| 3 | 11 |
| 4 | 100 |
| 5 | 101 |
| 7 | 111 |
| 8 | 1000 |
| 10 | 1010 |
| 16 | 10000 |
Bits and Bytes: The Vocabulary You Need
A single binary digit (0 or 1) is called a bit. Group 8 bits together and you get a byte. One byte can represent numbers from 0 to 255.
Why does this matter? File sizes, RAM, storage—all measured in bytes and their multiples:
- 1 KB = 1,024 bytes (roughly a paragraph of text)
- 1 MB = 1,024 KB (about a small image)
- 1 GB = 1,024 MB (a movie file)
- 1 TB = 1,024 GB (external hard drives)
How Computers Use Binary for Everything
Text
Each character gets assigned a number. ASCII and Unicode are just lookup tables. The letter "A" = 65. "a" = 97. "!" = 33. Your text editor converts characters to numbers, then to binary.
Images
Images are grids of pixels. Each pixel has a color value. That value is a number. Compressed into binary, your photo becomes a massive string of 0s and 1s.
Color
Screens use RGB (Red, Green, Blue). Each color channel gets a value from 0-255. Pure red is (255, 0, 0). That translates to three bytes of binary data.
Binary Logic: True or False
Binary also represents boolean logic. 1 = true. 0 = false. Every "if" statement in programming, every comparison, every decision your computer makes comes down to this:
- AND = both must be 1
- OR = at least one must be 1
- NOT = flips the value
These simple operations, repeated billions of times per second, run every program you use.
Getting Started: Read Binary Yourself
You can decode simple binary messages with ASCII. Each group of 8 bits maps to a character.
Example: 01001000 01100101 01101100 01101100 01101111
- 01001000 = 72 = "H"
- 01100101 = 101 = "e"
- 01101100 = 108 = "l"
- 01101100 = 108 = "l"
- 01101111 = 111 = "o"
That spells "Hello." Try it yourself with an online ASCII table.
Why This Matters
You don't need to memorize every binary conversion. But understanding that your computer's entire world is built on 0s and 1s changes how you think about technology. Debugging, memory issues, file corruption—these things make sense when you know what's actually happening under the hood.
Binary is the foundation. Everything else builds from there.