How Computers Count
Computers can only really tell the difference between two things: on and off β a 1 and a 0. Everything else β numbers, letters, pictures, songs β is built out of those two symbols. Here's how.
It's all the same number β only the number of symbols changes. Decimal uses ten symbols (0β9) because we have ten fingers. Computers use just two (0 and 1). Hexadecimal squeezes in sixteen (0β9 then AβF) as a shorthand, because one hex digit stands in for exactly four binary digits.
Each switch is a bit β a single on/off. Line up eight of them and you have a byte. Tap the switches: each "on" adds its number, and together they can count from 0 to 255.
Every letter has a number (its ASCII code), and that number is stored as a byte of 0s and 1s. Type anything and watch it become the exact code a computer keeps in memory.
| Character | ASCII | Binary (8 bits) | Hex |
|---|---|---|---|
| H | 72 | 01001000 | 48 |
| i | 105 | 01101001 | 69 |
| ! | 33 | 00100001 | 21 |
Your screen has no paint. Every dot is just three tiny lights β red, green and blue β each turned up somewhere between 0 and 255. Slide them and watch the number change with the color.
So where does #38BDF8 come from? Split the six characters into three pairs β one per light. Each pair is a number in hexadecimal, which counts 0β9 and then keeps going A, B, C, D, E, F for 10 to 15. The left digit is worth 16 of the right one:
Each light has 256 settings, so 256 Γ 256 Γ 256 gives 16,777,216 colors β more than your eye can tell apart β out of just three bytes.
Add one more switch and you don't get one more number β you get double. That doubling is why computers hit such strangely specific limits.
Most people can count to five on one hand. A computer would count to 31. Give each finger a value and hold up whichever ones you need.
More number toys
Jump into another calculator.