Why does any of this matter?
Every photo, message, video game, and AI model your computer has ever processed is, at its lowest level, nothing but a long stream of 1s and 0s. Understanding how numbers are represented in binary is the first real step toward understanding how hardware actually works โ not just conceptually, but mechanically.
Logitosaur says: "A computer doesn't think in numbers โ it thinks in voltage. High voltage = 1. Low voltage = 0. Everything else is interpretation."
The Decimal System (Base 10)
You've been using base-10 your whole life without thinking about it. Each digit position represents a power of 10:
4 2 7
โ โ โโ 7 ร 10โฐ = 7
โ โโโโ 2 ร 10ยน = 20
โโโโโโ 4 ร 10ยฒ = 400
โโโ
427
The "base" is just the number of symbols available (0โ9 for decimal). Binary uses only two symbols: 0 and 1.
Binary (Base 2)
In binary, each position is a power of 2. Starting from the right: 2โฐ, 2ยน, 2ยฒ, 2ยณโฆ
1 0 1 1
โ โ โ โโ 1 ร 2โฐ = 1
โ โ โโโโ 1 ร 2ยน = 2
โ โโโโโโ 0 ร 2ยฒ = 0
โโโโโโโโ 1 ร 2ยณ = 8
โโโ
11 (decimal)
Interactive: Click bits to flip them
Each box below is one bit. Click to toggle it between 0 and 1. Watch the decimal value update live.
Decimal value: 0
Number Converter
Type any number and instantly see it in all four bases used in computing.
๐ข Base Converter
Hexadecimal (Base 16)
Binary numbers get long fast. An 8-bit number like 11001101 is hard to read. Hexadecimal (base 16) groups four bits into one symbol, making it far more compact for humans to write.
| Decimal | Binary | Hex |
|---|---|---|
| 0 | 0000 | 0 |
| 5 | 0101 | 5 |
| 10 | 1010 | A |
| 15 | 1111 | F |
| 16 | 0001 0000 | 10 |
| 255 | 1111 1111 | FF |
You'll see hex everywhere โ CSS colours (#1a3d1f), memory addresses, colour values in images, and MAC addresses on networks.
Two's Complement & Negative Numbers
How do you represent โ5 in binary when there's no minus sign? The answer is two's complement โ the standard method used by virtually all modern hardware.
The method:
- Write the positive version in binary (e.g. 5 =
00000101) - Flip every bit (invert):
11111010 - Add 1:
11111011
So 11111011 represents โ5 in an 8-bit two's complement system. The leading bit is the sign bit โ if it's 1, the number is negative.
Why this works: 5 + (โ5) = 0. Try adding 00000101 + 11111011 in binary โ you get 100000000. Discard the overflow bit and you're left with 00000000 = 0. โ
Bits, Bytes, and Beyond
- 1 bit โ the smallest unit; a single 0 or 1
- 4 bits โ a nibble; one hex digit
- 8 bits โ a byte; can hold values 0โ255
- 16 / 32 / 64 bits โ word sizes used by modern CPUs
When you see a "64-bit processor," it means the CPU processes 64 bits (8 bytes) at a time in its registers. That's why 64-bit systems can address far more RAM than 32-bit ones โ the address space grows from ~4 GB to ~16 exabytes.
Check Your Understanding
Answer each question to test what you've learned. Select an option โ you'll get instant feedback, just like Khan Academy.