Eight switches, 256 numbers

Tap the switches. Each one is worth twice the one to its right. The number is just the sum of the switches that are on. Press Count up and watch the switches ripple like an odometer.

0
nothing on = 0

Decimal to binary by halving

Type a number. Keep halving, and read the remainders from the bottom up.

What's going on

Our usual numbers use place values 1, 10, 100, 1000 and ten digits. Binary uses place values 1, 2, 4, 8, 16 and only two digits: off and on. Any whole number can be made by choosing which switches to turn on, and there is exactly one way to do it.

Counting works like a car odometer. Add 1 to the rightmost switch. If it was already on, it turns off and carries a 1 to the left, and so on. That is why 7 (0111) becomes 8 (1000): three switches turn off and one turns on.

To turn a decimal number into binary, keep halving and write down the remainders. The remainders, read from the last to the first, are the switches. The demo shows every step.

Sheet: Counting to 31 on one hand.