> How a CPU works
12 animated episodes

How a CPU works, built from one transistor up

Start with a single switch. By episode 12 you will understand how a real processor remembers, counts, decides and runs programs. Plain language, no prior knowledge.

Start with episode 1Play it yourself

The series

  1. Frame from episode 1: From Sand to Switch: the Transistor and the Logic Gate
    EP 01

    From Sand to Switch: the Transistor and the Logic Gate

    A chip holds billions of tiny switches.

  2. Frame from episode 2: Building an Adder from Gates
    EP 02Coming soon

    Building an Adder from Gates

    A gate only answers yes or no, so how does a chip add five plus three? We count in binary, add by hand, and then build the half adder, the full adder and a chain of them out of nothing but gates.

  3. Frame from episode 3: Memory: the Latch, the Flip-Flop, the Register
    EP 03Coming soon

    Memory: the Latch, the Flip-Flop, the Register

    The adder gets the answer right, then instantly forgets it.

  4. Frame from episode 4: The Clock
    EP 04Coming soon

    The Clock

    Every flip-flop on the chip waits for the same beat.

  5. Frame from episode 5: Memory Addresses and the Program Counter
    EP 05Coming soon

    Memory Addresses and the Program Counter

    A phone has billions of memory slots and an app needs just one.

  6. Frame from episode 6: Instructions and Decoding
    EP 06Coming soon

    Instructions and Decoding

    An instruction is just a number in memory.

  7. Frame from episode 7: Jumps and Loops
    EP 07Coming soon

    Jumps and Loops

    Straight-line programs run once and stop.

  8. Frame from episode 8: Output
    EP 08Coming soon

    Output

    A CPU that cannot show its answer is not much use.

  9. Frame from episode 9: A Real Program
    EP 09Coming soon

    A Real Program

    Time to put it all together.

  10. Frame from episode 10: Functions and the Stack
    EP 10Coming soon

    Functions and the Stack

    Copying the same code everywhere wastes memory.

  11. Frame from episode 11: Interrupts
    EP 11Coming soon

    Interrupts

    Constantly polling a button wastes time.

  12. Frame from episode 12: From Our CPU to a Real One: pipelines, caches, billions of transistors
    EP 12Coming soon

    From Our CPU to a Real One: pipelines, caches, billions of transistors

    The series finale.

Now build it yourself

Every episode has a matching chapter in the free Build a CPU from scratch game. Watch Episode 1, then wire the same gates in Chapter 1, and keep going until you have built and programmed a whole 8-bit computer, breadboard by breadboard. It runs in your browser, on a phone too.

Play Build a CPU

Play it yourself in the free CPU simulator

Build the switch, watch the electrons, see exactly how a CPU works. Free, and it runs in your browser (desktop). Everything you see in these episodes, you can play with.

Open the simulatorSubscribe on YouTube