LogicGates.org Open the simulatorSimulator
Roadmap

What a bit is

Lesson 1 of 4 in this stage, about 8 minutes

One wire, two values, and why that is enough to build on.

Start with a light switch

Think about a light switch on a wall. It is either up or down. There is no "a bit up". Flip it and the lamp is on; flip it back and the lamp is off. That switch, the wire from it, and the lamp at the end are the whole of digital logic in miniature: something that is in one of exactly two states, and a wire that carries that state somewhere else.

A switch, a wire and a lamp. Click the switch.

The wire carries a 0

Inside a computer there are billions of these wires, and every one of them is doing the same thing the wire above is doing: carrying one of two values. We call the two values 1 and 0. That is a choice of names, nothing more. Electrically, a 1 is a wire held at a higher voltage and a 0 is a wire held at a lower one, which is why you will also hear high and low. Engineers also say on and off, or true and false. Same two values, four pairs of names.

Why only two?

It sounds limiting. A dial can be turned to any position, so why would you build a machine out of parts that only know two? The answer is that two is easy to get right. A wire that is meant to be at 5 volts might, through heat or interference, actually be at 4.7. If the rule is "anything above 2.5 counts as 1 and anything below counts as 0", that 4.7 is still a perfectly good 1. Nothing was lost. A dial with a hundred positions has no such slack: every little wobble changes the reading.

So digital circuits give up on carrying rich values along a wire and instead carry the simplest possible one, and they get in return a machine that can copy, store and shuffle those values a billion times a second without ever making a mistake. Everything richer, numbers, text, pictures, sound, is rebuilt out of bits further up.

Why?: what about the voltages?

You never need them for this course. Every circuit here works with pure 1s and 0s, and the simulator draws a 1 as a green wire and a 0 as a red one. If you go on to build circuits with real chips, the datasheet will tell you which voltage counts as which, and the rule above is all you need to make sense of it.

More than one bit

One bit answers one yes-or-no question: is the lamp on? To say anything more, use more bits. Put three switches side by side and read them left to right, and you can be in one of eight different situations: all off, only the right one on, only the middle one on, and so on. Click through them below.

Three bits. Click any of them and watch the pattern change.

0

Count the patterns: with one bit there are two, with two bits there are four, with three there are eight. Every bit you add doubles the count, because for every pattern you already had, the new bit can be 0 or 1. With eight bits there are 256 patterns; with thirty-two there are more than four billion.

Worked example. How many patterns can four bits make?

Start from one bit, which has 2 patterns, and double three more times: 2, 4, 8, 16. Four bits make 16 patterns. A quicker way to say the same thing is 2 × 2 × 2 × 2, which is written 24.

What a pattern means is up to whoever is using it. The pattern 101 might mean the number five, or the letter E, or "the second of three doors is closed". The bits do not care. That freedom is the second big idea of this course: a circuit only ever moves 1s and 0s around, and it is the design of the circuit that gives them a meaning. In the next lesson the meaning will be numbers.

Common mistake: a bit is not a small number

People sometimes read "bit" as "a little piece of data" and imagine it can hold a small value like 3 or 7. It cannot. A bit is exactly one of two things. To hold a 7 you need several bits working together, and the next lesson shows how.

What to remember

  • A wire in a digital circuit carries one of two values, called 1 and 0, high and low, or on and off.
  • One such value is a bit. It is either 1 or 0; there is nothing in between.
  • Two values are used because they are easy to tell apart, so the machine never misreads them.
  • Bits side by side make patterns, and each extra bit doubles how many patterns there are.

Check yourself

Get 5 right in a row and the lesson is done. A wrong answer costs the run, not the lesson.

0 right in a row. 0 / 0 this visit

How many different values can 5 bits hold?

Already know this? and come back to the quiz any time.

Go deeper