Every computer, underneath all the software, is just billions of tiny switches doing arithmetic with two values: 0 and 1. A handful of logic gates β AND, OR, NOT, XOR, NAND β turn those values into decisions. Wire a few together and you can add numbers. Wire billions together and you get a CPU. Scroll down, flip some bits, and watch the signal flow.
A gate takes one or two inputs (each 0 or 1) and produces one output. Pick a gate below, then click the input circles to toggle them between 0 and 1. Wires carrying a 1 light up green; a 0 stays dim. The truth table on the right lists every possible input combination β the current one is highlighted.
Adding two bits needs two outputs: the Sum and a Carry into the next column β exactly like carrying the 1 in grade-school addition. A half-adder is just an XOR (sum) plus an AND (carry). A full-adder also takes a carry coming in, so adders can be chained. Toggle bits A and B (and carry-in) and watch the gates resolve.
Now chain four full-adders into a 4-bit ripple-carry adder. Each column's carry-out feeds the next column's carry-in, so the carry ripples left β just how you add by hand. Toggle the bits of A and B and watch the carry propagate and the total appear.
One gate rules them all: NAND is universal β AND, OR, NOT, XOR and therefore every circuit (including this adder) can be built from NAND gates alone. Pack a few billion of them onto a chip, add memory and a clock, and you have a CPU.
How does flipping switches become Minecraft, a spreadsheet, this web page? By stacking layers, each one hiding the messy details of the one below:
A transistor is a microscopic electrical switch: a small voltage on one wire decides whether current can flow through another. A couple of transistors wired together are a logic gate. Modern chips hold tens of billions, each a few atoms wide.
Transistors form gates (AND, OR, NOT, NANDβ¦). Now we stop thinking about voltage and just think in 0s and 1s: true/false, on/off. Because NAND is universal, this single building block can express any logical function at all.
Wire gates into adders (you just built one), comparators, multiplexers, and latches that remember a bit. Logic becomes arithmetic; arithmetic plus stored bits becomes the ability to compute and to hold state.
Bundle the arithmetic unit, registers (memory), and a clock that steps the whole thing forward, and you get a processor that runs instructions. Stack software on top β machine code, languages, apps β and binary logic becomes everything a computer does.