digiwleea
The theory Tools Open the lab →

How memory works: the latch that remembers one bit

A computer's memory has no moving parts, yet it holds your data. The trick is a loop that feeds itself. Here it is, one step at a time.

Press Next to walk through it. Set the latch, release the input, and watch the bit stay put, then try it yourself.

What just happened

The circuit is an SR latch: two NOR gates wired so each one's output feeds back into the other's input. That feedback is the whole trick. Pulse Set and the loop flips so Q becomes 1; because the output loops back in, it keeps re-asserting that 1 even after you release the input. The bit is now held, with no clock and nothing moving, just a self-sustaining loop of voltage. Pulse Reset and the loop flips the other way, back to 0, and holds that instead.

That bistable loop is one bit of memory. Add a clock so it only changes on a tick and you have a flip-flop; line up eight and you have a register; build a huge grid of them and you have RAM. Every byte a computer remembers, from a single variable to the whole program, traces back to this feedback trick. And the gates themselves are built from transistors and wired into logic, the levels just below this one.

Common questions

How does a computer remember data?

Through feedback. Wire a gate's output back to its own input and the circuit reinforces its current state, holding it as long as it has power, no motion, no clock needed. The simplest such memory is a latch; millions of them (or tiny charge-storing capacitors) make up RAM.

What is an SR latch?

The simplest memory element. Pulsing Set makes the output Q become 1; pulsing Reset makes Q become 0; with both inputs 0 it holds the last value. It is two cross-coupled NOR gates (or two NANDs), each feeding back into the other.

What is the difference between a latch and a flip-flop?

A latch is level-sensitive (it reacts whenever its inputs are active); a flip-flop is edge-triggered (it only updates on a clock edge). A flip-flop is a latch plus clock control, which lets a whole register update in perfect step. See the D flip-flop lesson.

How can a circuit store a bit with no moving parts?

By feedback. The output is wired back to an input, so the circuit continuously drives itself into the state it is already in. Once set, it re-asserts its own 1 (or 0) indefinitely while powered. Nothing mechanical moves; the stored bit is just a self-sustaining loop of voltage.

What is a bit of memory made of?

A single bistable feedback loop, a latch, usually a handful of transistors. A register is eight flip-flops side by side. Static RAM is a grid of six-transistor cells; dynamic RAM instead stores each bit as a charge on a tiny capacitor that must be refreshed.

Read the theory: circuits that remember →

Embed this interactive

Free to embed in your course page, blog, or notes: just keep the credit link under the widget. Paste this where you want it:

<iframe src="https://digiwleea.wleeaf.dev/embed/tool/?w=memory" width="100%" height="520" style="border:0;border-radius:12px;max-width:600px" title="How computer memory works" loading="lazy"></iframe>