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.

DecimalBinaryHex
000000
501015
101010A
151111F
160001 000010
2551111 1111FF

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:

  1. Write the positive version in binary (e.g. 5 = 00000101)
  2. Flip every bit (invert): 11111010
  3. 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

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.