The building blocks of every computer, one gate at a time. Pick a gate — AND, OR, NOT, NAND, NOR, XOR or XNOR — flip the binary inputs, and watch the wires and output light up for logic 1. Beside the gate, its truth table highlights the row for whatever inputs you've set, so the rule becomes obvious. It's pure boolean logic — exact, and running entirely on your device.
You are in the Physics lab.
De Morgan's laws tie the family together: NOT (A AND B) = (NOT A) OR (NOT B), and NOT (A OR B) = (NOT A) AND (NOT B). That symmetry is exactly why NAND or NOR alone can build every other gate — flip inputs and output and one universal gate becomes another.
What the lit wires, the output LED and the highlighted table row are telling you.
The two input toggles set A and B to 0 or 1, and those bits travel down the wires into the gate symbol. Each wire glows cyan for logic 1 and stays grey for 0, and a small 0/1 tag sits on every wire so you can read its value at a glance. For a NOT gate only the A wire is live — B is disabled, because an inverter has a single input.
The symbol carries the gate's one fixed rule, and the negated gates (NAND, NOR, XNOR, NOT) add the little bubble that flips the result. The output wire and the LED on the right show the answer: the LED lights and reads 1 when the gate outputs 1, and stays dark on 0. The readouts spell the same result as a boolean expression and name the gate type, and flag whether it is a universal gate.
Beside the symbol is the gate's full truth table — four rows for a two-input gate (00, 01, 10, 11), two for NOT. The row matching your current inputs is boxed and highlighted, so as you toggle A and B the highlight walks down the table and you can see how each of the possible input combinations maps to an output.
Binary inputs, one fixed rule per gate, and the truth table that captures it.
A logic gate takes one or two inputs, each either 0 (low) or 1 (high), and produces a single output bit. In this simulator the input dots and wires glow cyan for 1 and stay grey for 0, each wire carries its 0/1 tag, and the output LED lights when the gate outputs 1 — so you can trace the signal straight through.
AND outputs 1 only if both inputs are 1; OR if either is; NOT inverts a single input. NAND, NOR and XNOR are those with the output flipped (shown by the little bubble on the symbol), and XOR outputs 1 only when the inputs differ. Switch gates, or use a preset, and the symbol and rule change together.
List every input combination and the output for each and you have the truth table — the complete definition of the gate. A two-input gate has four rows; NOT has two. NAND and NOR are universal: any other gate can be built from copies of just one of them, which is why real chips are seas of identical NAND gates. As you toggle A and B, the matching row is highlighted so you can check your predictions against it.
Teaching digital logic or Boolean algebra? You can embed this simulator on your own site free — one line of code, no sign-up.
A ready-to-assign lab using the simulation above. Free to use — nothing to install or sign up for, and no student data leaves the browser.
Fill in a truth table for each gate you test.
Logic gates output a 1 or 0 from their inputs by fixed rules: AND needs all inputs true, OR any, NOT inverts, XOR needs them different. Their truth tables fully define them, and NAND or NOR alone can build any digital circuit.
Educators: link or embed this simulation freely in your LMS or course guide.
Put the Logic Gate Simulator on your own page — free, no sign-up, no watermark. It runs entirely in your visitors' browsers. Copy the snippet and paste it into your page's HTML.