Binary: how computers store numbers

Computer Science · Key Stage 3 · The School

Base 2

Decimal uses ten digits and place values of 1, 10, 100. BINARY uses two digits and place values of 1, 2, 4, 8, 16, 32, 64, 128. To read binary, add the place values wherever there is a 1: 1011 is 8 + 0 + 2 + 1 = 11. To write a number in binary, take the largest place value that fits and work down.

Why two digits

Computers are built from switches, and a switch is reliably either on or off. Distinguishing two states is easy and survives electrical noise; distinguishing ten voltage levels would be error-prone. Binary is not a mathematical necessity — it is an engineering choice that makes hardware simple and reliable, and everything else follows from it.

Everything becomes a number

Text is stored by giving each character a number — in ASCII, capital A is 65. Images are grids of pixels, each pixel a set of numbers for red, green and blue. Sound is the height of a wave sampled thousands of times a second. A computer stores nothing but numbers; the meaning comes from which program reads them.

Binary to decimal: 10110110. Write the place values above it — 128, 64, 32, 16, 8, 4, 2, 1 — and add the ones that are on: 128 + 32 + 16 + 4 + 2 = 182. Decimal to binary: take 200. Does 128 fit? Yes, 72 left. 64? Yes, 8 left. 32? No. 16? No. 8? Yes, 0 left. So 11001000. Check it by adding back: 128 + 64 + 8 = 200.

Why computers count this way at all

Binary is not chosen because it is elegant; it is chosen because it is reliable. A circuit can tell "voltage present" from "voltage absent" with almost no chance of confusing them, and that is one bit. Ten different voltage levels for the digits 0 to 9 would be far harder to keep apart as components warm up and age, and a small drift would turn a 6 into a 5. Two states means the gap between them is enormous, so noise has to be enormous to matter. Everything else — bytes, hexadecimal as shorthand, binary arithmetic — follows from that single engineering choice.

The School — all subjects · Knowledge map