Logic Gate Simulator
Interactive CS Tools

Logic Gate Simulator

Drag gates onto the board, wire them up and flip the switches. The truth table and Boolean expression update as you build.

Mode
Level
Toolbox
Drag onto the board, or click to add.

How to use it

1Add partsDrag switches, lamps and gates from the toolbox, or click them to add.
2ConnectDrag from an output dot (right side) to an input dot (left side). On a tablet, tap one dot, then the other.
3TestClick a switch to flip it between 0 and 1. Yellow wires carry a 1.
4Fix mistakesClick a gate or wire, then press Delete. Press Esc to cancel a wire.

Meet the gates

Where are logic gates?

  • Inside every computer, phone and game console. A modern chip has billions of them!
  • A gate is a tiny switch that decides “on” or “off” based on its inputs.
  • Joining gates together lets computers add numbers, compare things and make decisions.

Boolean algebra

A · BAND: 1 only if both are 1
A + BOR: 1 if at least one is 1
¬ANOT: flips 0 and 1
A ⊕ BXOR: 1 if the inputs differ
¬(A · B) = ¬A + ¬BDe Morgan’s law, the reason NAND can build OR

Try this in class

Two roads, one answerBuild XOR once with an XOR gate and once with AND, OR and NOT. Compare the truth tables. Are they really the same circuit?
Make it realDesign a circuit for a game: the door opens (lamp X) only when you have the key (A) and you are next to the door (B). Which gate do you need?
The universal gateEvery other gate can be built from NAND alone. Work through the NAND challenges and see why chip makers love it.
Keyboard: Delete remove selected · Esc cancel connection