ENES

Binary code

Writing everything, numbers, text, images, with only two symbols: 0 and 1.

The number 13 written in binary as 1101, with each digit under its place value 8, 4, 2 and 1, and the sum 8 + 4 + 1 = 13

Binary code is a way of representing information using only two symbols, 0 and 1. Computers use it because their hardware is built from billions of tiny switches, transistors, that are either on or off. Two states are easy to tell apart reliably, even when electrical signals are a bit noisy, so everything a computer stores or processes ends up as long strings of zeros and ones.

Binary numbers work like the decimal numbers you already know, just with two digits instead of ten. In decimal, each position is worth ten times the one to its right: ones, tens, hundreds. In binary, each position is worth twice as much: 1, 2, 4, 8, 16 and so on. So 1101 means one 8, one 4, no 2 and one 1, which adds up to 13.

Anything else is a matter of agreeing on a code. Text uses tables like ASCII or Unicode, where the capital letter A is the number 65, or 01000001. An image is a grid of pixels, each with numbers for its red, green and blue. A song is thousands of sound measurements per second. Even the programs themselves are binary: the instructions a CPU runs are patterns of bits that tell it what to do next.

Keep in mind

Go deeper

Related terms

More in Hardware