Logic Gate Sandbox
Wire up gates, flip the switches, and watch a circuit remember.
Loading the board…
About the Logic Gate Sandbox converter
Place AND, OR, NOT, NAND, NOR and XOR gates, wire them to switches and lamps, and watch the current flow as you flip things. The truth table underneath fills itself in by running your circuit, not by reading the gates.
Every processor ever built is these parts, repeated. Starting from nothing and arriving at something that adds — or something that remembers — takes about twenty minutes and is genuinely startling the first time.
Start with addition
The half adder is the first circuit worth building: two switches in, two lamps out. One lamp gives the sum of the bits and the other gives the carry — which is exactly what you do by hand when a column adds up to more than the base allows.
It takes one XOR and one AND. Chain two half adders together with an OR gate and you can add three bits at once, which is what lets a carry travel from one column into the next. Repeat that across eight columns and you have built the adder inside a real processor.
Then build something that remembers
Wire two NOR gates so that each one feeds the other, and something strange happens: the circuit holds a value. Flick Set on, flick it off again, and the lamp stays lit. Flick Reset and it goes out, and stays out.
Nothing in there is storing anything. There is no memory cell, no battery, no component whose job is to remember. The state is simply the loop chasing itself — each gate holding the other in place. That is what a bit of memory actually is, and watching it happen is a different kind of understanding from reading about it.
This is also why the sandbox does not simply follow a circuit from left to right. A simulator that assumes signals only ever flow forwards cannot run a latch at all. Here the whole board is settled by repeated passes instead, so loops work exactly as they do in hardware.
Circuits that never settle
Wire a NOT gate to its own input and ask what it does. If it is off, it must be on; if it is on, it must be off. There is no answer, and real hardware behaves the same way — it oscillates, flipping as fast as the components allow. It is how a clock signal gets made.
Rather than freezing or picking an arbitrary answer, the sandbox notices that the circuit never comes to rest and says so.
The truth table writes itself
Below the board, every combination of your switches is listed with what the lamps do. It is produced by actually running the circuit for each combination rather than by analysing the gates, so it is right about anything you can build.
For a circuit with memory that is a simplification, and the table says so: each row starts from a blank slate, so it describes the circuit rather than the particular order you happened to click through it.
Nothing to sign up for
The board is saved in your own browser as you work, so closing the tab does not lose it. Export writes a plain file you keep and can bring back later or move to another machine.
It all runs on your device. No account, no upload, and nothing about what you build is sent anywhere.
Frequently asked questions
What can I actually build with this?
Half and full adders, multiplexers, decoders, comparators, and latches — the building blocks of a processor. Anything made of AND, OR, NOT, NAND, NOR and XOR gates with switches and lamps.
Can I make a circuit that remembers?
Yes. Two NOR gates feeding each other make an SR latch, which holds its value after you release the switch. It is loaded as one of the examples, because it is the moment the whole subject becomes interesting.
Why does it say my circuit never settles?
Because it genuinely cannot. Something is feeding back in a way with no consistent answer — a NOT gate wired to itself is the simplest case. Real hardware oscillates in exactly that situation, and it is how clock signals are generated.
How is the truth table worked out?
By running your circuit once for every combination of the switches and recording what the lamps do. Nothing is inferred from the shape of the circuit, so it is correct for anything you can wire up.
Are two wires into the same input allowed?
No, and that is deliberate. An input fed from two places has no defined value in real hardware either. Each input takes one wire; use an OR gate if you want to combine two signals.
Is my circuit saved?
It is kept in your own browser as you work, so it survives closing the tab. Since it lives only on this device, clearing your browser data removes it — export writes a file you can keep and re-import later.