Base CS from zero
Bits and binary
Every piece of data your computer has ever touched — every character you typed, every pixel on this screen, every number in every calculation — is stored as some arrangement of exactly two symbols: 0 and 1. Not ten symbols like the digits we use to count. Not letters. Just two. Why two, and what does that even mean in hardware?
After this lesson you can explain what a bit is, why hardware is built around exactly two states rather than ten, and how a row of bits becomes the atom of all data.
A bit is the smallest possible unit of information. The word “bit” is short for binary digit — a digit from the base-2 number system. While the decimal digits you know (0 through 9) are ten symbols, the only binary digits are 0 and 1. One bit is one choice between two possibilities: off or on, false or true, low or high. That is the whole definition. A single bit cannot represent anything more subtle than that one binary choice.
Hardware is built from switches, and switches have two states. Inside a computer chip are billions of tiny transistors. A transistor is an electrically controlled switch: apply enough voltage to the control pin and current flows through (the switch is on, we call it 1); remove the voltage and current stops (the switch is off, we call it 0). The transistor does not have a “halfway” state for everyday purposes — it is designed to be solidly on or solidly off. That physical reality is why hardware talks in two symbols.
Two states, not ten, because of electrical noise. In any real circuit, voltage is never perfectly stable. Temperature changes, nearby signals, power supply variation — all of these cause small fluctuations. If a computer used ten voltage levels to represent the ten decimal digits (0 V for 0, 0.5 V for 1, 1.0 V for 2, … up to 4.5 V for 9), a fluctuation of just 0.2 V could shift a signal from one level to a neighboring one and corrupt data. With only two levels — say “low” (0–1 V) and “high” (3–5 V) — there is a large gap between them. A small fluctuation almost never crosses that gap. The bigger the gap relative to the noise, the more reliably hardware can read which state a signal is in. Two states maximise that gap for a given supply voltage, and that is why binary won.
Why this works
Engineers did try multi-level storage. Modern NAND flash chips store 2, 3, or even 4 bits per cell by distinguishing four to sixteen voltage levels per cell (MLC, TLC, QLC). This works only because flash is optimised for high-density storage and accepts slower, less reliable reads with strong error-correcting codes. General-purpose logic — the kind that runs your program at full speed — still uses two states because two states are the fastest and most noise-immune.
A bit by itself is too small to be useful on its own. One bit can only say “yes or no.” To represent a wider range of values, hardware groups bits together. Eight bits grouped together form a byte — enough to hold one of 256 distinct values (0 through 255). A modern 64-bit integer uses 64 bits and can hold one of over 18 quintillion values. But no matter how many bits you group, every group is ultimately composed of individual bits, each one a transistor that is either on or off.
Reading a row of bits.
Suppose a chip stores this byte: 0 1 0 1 0 0 1 1.
Each cell contains one bit. Reading left to right we see: off, on, off, on, off, off,
on, on. Each “on” cell is a transistor holding high voltage; each “off” cell holds low
voltage. There are exactly eight switches here, and the pattern 01010011 is one of
exactly 256 possible patterns an eight-switch byte can produce. Later lessons will show
how such a pattern encodes a number or a character — but for now notice that the entire
thing is built from nothing but the two-state choice: 0 or 1.
No switch is “sort of on.” No switch holds a value between 0 and 1. The reliability of the whole system rests on that sharp distinction.
Common mistake
A common first misconception is that 0 means “nothing stored.” It does not. A bit set to 0 is actively holding the value zero — a transistor that is firmly off. The cell is occupied; its value is just zero. An uninitialized memory cell is not zero by default; it holds whatever value was last written there. Zero is a real, definite value.
How many distinct states can a single bit hold? Type the number.
How many bits are in one byte? Type the number.
How many distinct values can a 2-bit pattern hold? (00, 01, 10, 11 — count them.) Type the number.
How many distinct values can one byte (8 bits) hold? Type the number.
A voltage signal can be either 0.2 V or 4.8 V. The noise in the circuit is ±0.3 V. Can the circuit reliably tell the two states apart? Type 1 for yes, 0 for no.
Why does computer hardware use exactly two states (0 and 1) rather than ten (0–9)?
A bit is a binary digit: the single two-state unit of all digital data. Hardware represents it as a transistor that is either on (1) or off (0). Two states are used rather than ten because two voltage levels leave a wide noise margin — small electrical fluctuations cannot easily flip a 0 into a 1 or vice versa. Bits are grouped into bytes (8 bits) and larger units to represent richer values, but every group is ultimately composed of individual bits, each one a firm, unambiguous choice between two states.