← All animations

πŸ”’ How Computers Count

A computer has no idea what a "7" is. Deep down it only knows two things β€” on and off, 1 and 0. Yet from nothing but switches it counts, stores your words, and paints this page. The trick is place value: just like our decimal columns are ones, tens, hundreds, binary's columns are 1, 2, 4, 8… powers of two. Flip the switches below and watch numbers appear.

1. An 8-bit register β€” flip the switches

Here are eight bits (binary digits), together one byte. Each bit owns a place value β€” a power of two. A bit that's on adds its place value to the total; that's all "reading binary" is. Click a bit to toggle it. The biggest a byte can hold is 11111111 = 255.

Click some bits…
0 in decimal
Watch it roll over like an odometer
0x00 0b00000000

2. Beyond whole numbers β€” text, hex & negatives

Text is just numbers. Every character has a code (ASCII / Unicode), and that code is stored as a byte. Type one character and watch its byte light up:

"A"  β†’  code 65  Β·  01000001  Β·  0x41

Try a vs A (differ by 32), a space, a digit like 0, or an emoji.

Hexadecimal is binary shorthand. Long binary strings are hard to read, so we chunk the byte into two groups of 4 bits (a nibble). Four bits have 16 combinations β€” exactly the 16 hex digits 0–9, A–F. So one hex digit == one nibble:

Negative numbers? Computers use two's complement: the top bit becomes a sign worth βˆ’128, so the same 8 switches now span βˆ’128…+127. Flipping the toggle below re-reads the same register from Scene 1 as signed.

Value reads as 0

In two's complement, to negate a number you flip every bit and add 1.

3. Why binary? The short version

BitsCombinations (2n)Everyday name
12a single switch
4 (nibble)16one hex digit
8 (byte)256one character / 0–255
101,024β‰ˆ 1 kilobyte
1665,536a "short" integer
201,048,576β‰ˆ 1 megabyte
324,294,967,296β‰ˆ 4 GB address space