Why Do Computers Use Binary?

Because the tiny switches inside a chip are most reliable with just two states: on and off.

Short answer

A computer chip is made of billions of transistors, and each one works like a tiny switch: on or off. Two states are easy to tell apart even when electrical signals are a little noisy, so engineers represent them as 1 and 0. Everything else — numbers, letters, photos, music — is built from long patterns of those two digits.

In this article 7 sections
  1. Switches, not fingers
  2. Why not ten voltage levels?
  3. How 0s and 1s become everything
  4. Logic in hardware
  5. A short history
  6. Common questions
  7. Related guides
An ERA 1103 UNIVAC computer at a NASA research centre in 1955
An ERA 1103 (UNIVAC 1103) at NASA’s predecessor NACA in 1955. Like every computer since, it worked in binary. Image: NACA / Wikimedia Commons, Public domain

Switches, not fingers

We count in tens, probably because we have ten fingers. A computer’s building blocks don’t have fingers; they have transistors. Intel describes them as microscopic switches, and a modern processor packs in millions or even billions of them.1

A switch has two clear positions, on and off, so it is natural to label them 1 and 0. In a memory cell, a 1 is stored as a higher voltage and a 0 as a lower one. On a disk the same bit might be stored as magnetism, and on a network it can travel as light, voltage or sound.5

The front panel of a DEC PDP-8/S minicomputer at the Computer History Museum, with a row of orange and white toggle switches under rows of indicator lamps.
On early computers such as this PDP-8/S, each front-panel switch set a single bit to 1 or 0, and the lamps above showed bits the same way. Photo: ajmexico / Wikimedia Commons, CC BY 2.0

Why not ten voltage levels?

Electronic parts are never perfectly accurate. Kennesaw State University points out that manufacturing tolerance is often around ±10%: a resistor labelled 100 ohms might really measure anywhere from 90 to 110.3

Now imagine a decimal computer that used ten voltage levels, from 0 V to 9 V. A signal meant to be 7 V could arrive as 6.7 V or 7.2 V and still be read as seven, but a drift to 7.7 V would be read as eight — a wrong digit.3

Binary leaves far more room for error. One common type of circuit uses 0 V for 0 and 5 V for 1, and treats anything below about 2.5 V as a 0. That is a margin of almost 50%.3

This brings two more benefits. Because a binary signal is clearly on or clearly off, small amounts of electrical noise can be filtered out, so digital copies can be perfect. And two-state parts are simple to build, so huge numbers of them fit into a tiny space.2,4

How 0s and 1s become everything

One binary digit is a bit — the word is short for “binary digit”.5 Each extra bit doubles the number of patterns you can make: two bits give 4 combinations, three give 8 and four give 16.9

Group eight bits together and you have a byte.3,5 With eight bits there are 2⁸ = 256 possible patterns — enough for a letter, a small number or a useful range of colours.5

Text works by agreement. The ASCII standard, published in 1968, gives each letter, digit and common symbol a number, so that different computers read the same file the same way.7 Capital letters run from 65 to 90.6

PatternAs a numberAs text (ASCII)
0100000165A
0100001066B
00110001491

The binary column is simply the ASCII number written in base 2.6,7

The US-ASCII code chart: a grid of letters, digits, symbols and control codes, with the binary bit patterns for each column and row along the top and left edges.
The original US-ASCII code chart: a character’s column bits and row bits together give its 7-bit binary code. Image: US Government / Wikimedia Commons, Public domain

Photos and music follow the same idea. Anything that can be described as a pattern — numbers, text, images, sound — can be stored in binary.2 The number of bits matters: more bits per pixel give more accurate colours, and more bits per sound sample give better audio.5

Count to eight in binary

0, 1, 10, 11, 100, 101, 110, 111, 1000. Each place is worth double the one to its right — 1, 2, 4, 8 — instead of ten times, as in everyday numbers. So twenty-nine is written 11101: 16 + 8 + 4 + 1.4

Logic in hardware

Binary also matches simple logic. Circuits called logic gates combine bits using rules such as NOT (flip the bit), OR (output 1 if either input is 1) and AND.1,8

Gates are built from transistors, and gates combine into bigger circuits. Intel notes that a circuit able to add two numbers needs fewer than 30 transistors; stack enough of these blocks together and you get a processor that can calculate, store results and run programs.1

It’s also why storage sizes look odd

Because computers work in powers of two, some systems count a kilobyte as 1,024 bytes. See Why Is a Kilobyte Sometimes 1,024 Bytes?

A short history

  • 1679: Gottfried Leibniz wrote a paper on binary numbers.3
  • 1850s: George Boole developed an algebra that works on binary values — the maths behind logic gates.3
  • 1937: Claude Shannon’s master’s thesis at MIT showed that this logic could be carried out with electrical switching circuits.8
  • 1945: ENIAC, the first programmable, electronic, general-purpose digital computer, was completed with 18,000 vacuum tubes.1 It worked in decimal, so each decimal digit needed ten on/off devices.3
  • 1947: The transistor was first demonstrated at Bell Labs.1
  • 1948: Shannon’s paper “A Mathematical Theory of Communication” laid the foundations of information theory.2

John von Neumann spotted the waste in ENIAC’s approach: ten on/off devices used as a 10-bit binary number can count from 0 to 1,023, not just from 0 to 9.3

Common questions

Is binary just for numbers?

No. Binary is only a way of writing patterns, and a pattern can stand for anything people agree on — a letter, a colour or a sound sample.2,9

Could computers ever move beyond binary?

Researchers have explored it. Computerworld described spintronics, which uses the spin of electrons to hold more than two states, as one possible route.8 For now, binary remains the practical choice because two-state circuits are reliable and make the best use of the hardware.3

How many bits do I need for something?

Work in powers of two. Five bits give 32 values, and storing 1,000 different values needs at least 10 bits.5

Sources and further reading

  1. The Transistor, Explained — Intel Newsroom
  2. Binary and Its Advantages — Chemeketa Community College CS160 Reader
  3. Binary Numbers — Kennesaw State University
  4. Modern Computers Are Binary — Calvin University
  5. Binary numbers: What’s it all about? — CS Unplugged, University of Canterbury
  6. Representing Letters with ASCII — Chemeketa Community College CS160 Reader
  7. CS 240 ASCII FAQ — Purdue University
  8. Binary basics — Computerworld2007-03-26
  9. An introduction to computers and computer systems: Representing data with bits — The Open University (OpenLearn)

Was this article helpful?

Comments

No comments yet. Questions and tips from readers are welcome.