The Binary Number System- A Beginner's Complete Guide
What the Heck Is Binary Anyway?
Binary is a number system that uses only two digits: 0 and 1. That's it. No 2s, no 3s, nothing fancy. Your computer runs on this. Every pixel on your screen, every letter you're reading right now, every video you've ever watched—all of it comes down to strings of 0s and 1s.
Humans use decimal (base-10). You have ten fingers, so it made sense historically. But computers don't have fingers. They have electrical circuits that are either on or off. On = 1, Off = 0. Binary is the language that matches how hardware actually works.
Why Binary, Not Something Else?
You could theoretically build a computer using any number system. The USSR actually built a ternary computer (base-3) called Setun in 1958. It didn't catch on.
Binary won because it's dead simple to implement in hardware. Transistors are either conducting or not conducting. Capacitors are charged or not charged. Two states. Reliable. Cheap. Easy to distinguish between noise and signal.
With decimal, you'd need to distinguish between 10 different voltage levels. That's error-prone and expensive. With binary, you only need to detect two levels. Much more reliable.
The Place Values in Binary
This is where most people get confused. In decimal, you have ones place, tens place, hundreds place, and so on—each place value is 10 times larger than the previous.
Binary works the same way, except each place value is 2 times larger than the previous:
- Rightmost digit: 2⁰ = 1
- Next digit: 2¹ = 2
- Next: 2² = 4
- Next: 2³ = 8
- Next: 2⁴ = 16
- Next: 2⁵ = 32
- Next: 2⁶ = 64
- Next: 2⁷ = 128
See the pattern? Each step doubles the value. This is called powers of 2, and memorizing these will save you hours of frustration later.
Reading Binary Numbers
Let's break down the binary number 11010:
Starting from right to left, assign place values:
1 1 0 1 0
16 8 4 2 1
Multiply each digit by its place value and add them up:
- 1 × 16 = 16
- 1 × 8 = 8
- 0 × 4 = 0
- 1 × 2 = 2
- 0 × 1 = 0
16 + 8 + 0 + 2 + 0 = 26
So 11010 in binary equals 26 in decimal. That's all there is to it.
How to Convert Decimal to Binary
The division method works every time. Take your decimal number and divide by 2 repeatedly, keeping track of the remainders. When you're done, read the remainders from bottom to top.
Let's convert 42 to binary:
- 42 ÷ 2 = 21 remainder 0
- 21 ÷ 2 = 10 remainder 1
- 10 ÷ 2 = 5 remainder 0
- 5 ÷ 2 = 2 remainder 1
- 2 ÷ 2 = 1 remainder 0
- 1 ÷ 2 = 0 remainder 1
Read from bottom to top: 101010
Let's verify: 1×32 + 0×16 + 1×8 + 0×4 + 1×2 + 0×1 = 32 + 8 + 2 = 42. Correct.
Binary Addition—No Carrying Tricks
Binary addition follows four simple rules:
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 10 (which is 0 with a carry of 1)
When you get 1 + 1 + 1 (with a carry from the previous column), you get 11, which is 1 with a carry of 1.
Example: 101 + 011
101 + 011 ------ 1000
Starting from the right: 1+1=10, write 0 carry 1. Next column: 0+1+carry1=10, write 0 carry 1. Next: 1+0+carry1=10, write 0 carry 1. Finally, write the carry. Result: 1000 (which is 8 in decimal).
Bits, Bytes, and What They Mean
A single binary digit is called a bit. That's a 0 or a 1.
Eight bits make a byte. One byte can represent 256 different values (0-255). This is why 8-bit color gives you 256 shades per channel, why old game consoles were called "8-bit," and why IPv4 addresses are broken into four bytes.
Common groupings you'll see:
- 8 bits = 1 byte
- 16 bits = 2 bytes = can store 65,536 values
- 32 bits = 4 bytes = can store over 4 billion values
- 64 bits = 8 bytes = can store an astronomical number of values
Where Binary Shows Up in Real Life
ASCII and Text Encoding
Every character you type gets assigned a number. The letter 'A' is 65. 'a' is 97. '0' (zero) is 48. In binary, 'A' is 01000001. Your computer stores text by storing these numbers.
IPv4 Addresses
192.168.1.1—each number is a byte (0-255). The entire address is 32 bits. That's why IPv4 only supports about 4 billion unique addresses, which we've nearly exhausted.
RGB Color Codes
#FF5733—each pair of hex digits represents a byte for Red, Green, and Blue intensity. Each color channel goes from 0 to 255. That's 256 × 256 × 256 = 16.7 million possible colors.
Boolean Logic
TRUE and FALSE. 1 and 0. Every comparison your code makes—if (x > 5)—boils down to binary decisions. This is why we call it boolean after mathematician George Boole.
Quick Reference: Binary to Decimal
| Binary | Decimal | Notes |
|---|---|---|
| 0000 | 0 | Nothing |
| 0001 | 1 | 2⁰ |
| 0010 | 2 | 2¹ |
| 0100 | 4 | 2² |
| 1000 | 8 | 2³ |
| 1111 | 15 | Maximum 4-bit value |
| 11111111 | 255 | Maximum byte value |
| 10000000 | 128 | Highest bit in a byte |
Getting Started: Practice Problems
You won't learn this by reading. You have to do it yourself.
Convert these decimals to binary:
- 7 → 111
- 15 → 1111
- 100 → 1100100
- 255 → 11111111
Convert these binary numbers to decimal:
- 1010 → 10
- 11111111 → 255
- 10000000 → 128
- 01010101 → 85
Check your answers with a calculator. The Windows calculator in programmer mode shows you binary, decimal, hex, and octal simultaneously. Use it.
The Bottom Line
Binary isn't complicated. It's just base-2 instead of base-10. The math is elementary. The reason it seems hard is that nobody bothered to explain it properly, and most explanations throw unnecessary jargon at you.
You now know everything you need to understand how computers actually store and process information at the fundamental level. The rest is just building on these basics.