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.

The same number, in every base
βœ‰οΈ Email
Binary (base 2)101010
Octal (base 8)52
Decimal (base 10)42
Hexadecimal (base 16)2A
Base 36 (0–Z)16

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.

Build a byte, one switch at a time
βœ‰οΈ Email

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.

Binary
01010101
Decimal value
85
As a letter (ASCII)
U
How a computer stores your words
βœ‰οΈ Email

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.

CharacterASCIIBinary (8 bits)Hex
H720100100048
i1050110100169
!330010000121
Every color is three numbers
βœ‰οΈ Email

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.

#38BDF8

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:

Red
38 = (3 Γ— 16) + 8 = 56
Green
BD = (B=11 Γ— 16) + D=13 = 189
Blue
F8 = (F=15 Γ— 16) + 8 = 248

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.

How high can a row of switches count?
βœ‰οΈ Email

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.

8 switchesup to 255
18 = a byte3264
One byte. Every letter in this sentence fits in one, and so does every shade of red on your screen.
Count to 31 on one hand
βœ‰οΈ Email

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.

11
1 + 2 + 8 = 11
Both hands together get you all the way to 1,023.

More number toys

Jump into another calculator.