Logic Gate Simulator — Build Digital Circuits
Drag and drop AND, OR, NOT, XOR, NAND, NOR, and BUFFER gates onto a canvas. Wire them together and toggle input signals to see how logic propagates through your circuit in real time. No signup, runs entirely in your browser.
⏱ 7 min read · Complete guide below
How to Use the Logic Gate Simulator
- 1Drag gates (AND, OR, NOT, XOR, NAND, NOR, BUFFER) and input nodes onto the canvas.
- 2Switch to Connect mode, click an output, then click a destination input port to wire them.
- 3Click input nodes to toggle 0/1; green wires carry HIGH, grey carry LOW.
- 4Use Delete mode to remove a gate or wire and iterate on your design.
Worked Example: Building a Half Adder
A half adder adds two single bits, A and B, and produces two outputs: a Sum and a Carry. Place two input nodes and wire both into an XOR gate — that output is the Sum, because XOR is 1 only when the inputs differ (0+0=0, 0+1=1, 1+0=1, 1+1=0 with a carry). Wire the same two inputs into an AND gate — that output is the Carry, which is 1 only when both bits are 1. Toggle the inputs through all four combinations and read the outputs: 1+1 gives Sum 0, Carry 1 — binary for 2, exactly right.
That two-gate circuit is the atom of all binary arithmetic: chain a full adder (which adds a carry-in too) eight times and you have a byte adder, the core of an ALU. The simulator is also the fastest way to see that NAND is universal — build a NOT from a single NAND by tying its inputs together, then an AND from two NANDs, and you can reconstruct every other gate. That is why real chips are fabricated largely from one repeated NAND cell.
What Logic Gates Are
Logic gates are the fundamental building blocks of every digital device, from a calculator to a supercomputer. Each gate takes one or more binary inputs — signals that are either HIGH (1)or LOW (0) — and produces a single output according to a fixed rule. An ANDgate outputs 1 only when all its inputs are 1; an OR gate outputs 1 when any input is 1; a NOT gate (inverter) flips its single input. XOR outputs 1 when its inputs differ, while NAND and NOR are the inverted versions of AND and OR. In real hardware these gates are made from transistors, but at the logical level they behave exactly as this simulator shows — which is why toggling an input and watching the output change is the clearest possible introduction to digital logic.
From Gates to Computers
The remarkable thing about logic gates is how much emerges from combining a few simple rules. Wire two gates together, as in the half-adder example above, and you can add two bits; chain those into full adders and you can add whole numbers; combine adders with other gate arrangements and you build the arithmetic logic unit (ALU) at the heart of a processor. Other gate combinations create multiplexers(which select one of several inputs), decoders, and, with feedback, memory elements that can store a bit. Every complex digital system is ultimately a vast network of these same basic gates, which is why being able to build and trace small circuits by hand is such a valuable foundation.
Why NAND and NOR Are Universal
One of the most elegant facts in digital logic is that NAND and NOR are “universal” gates — any logic function whatsoever can be built using only NAND gates, or only NOR gates. You can see it directly in the simulator: tie both inputs of a NAND together and it behaves as a NOT; feed two NANDs in the right arrangement and you recreate an AND or an OR. Because a single gate type can express everything, chip manufacturers often fabricate large parts of a design from one repeated cell, which simplifies manufacturing and testing. This universality is also a favourite exam topic, and reconstructing the basic gates from NANDs is a genuinely satisfying way to prove it to yourself.
Tips for Building Logic Circuits
Build a half adder
A half adder adds two single bits. Connect A and B to an XOR gate for the Sum output and to an AND gate for the Carry output. This is the fundamental building block of binary arithmetic.
De Morgan's theorem
De Morgan's law states: NOT(A AND B) = (NOT A) OR (NOT B). You can verify this using a NAND gate and comparing its output to two NOT gates feeding an OR gate — both produce the same truth table.
Universal gates
NAND and NOR are universal gates — any logic function can be implemented using only NAND gates or only NOR gates. This matters for chip manufacturing where a single gate type simplifies fabrication.
Read with the truth table
Use the Truth Table Generator tool to verify complex expressions. Build the circuit here, record the outputs for all input combinations, then compare to the expected truth table.
Frequently Asked Questions
What logic gates are supported?
The simulator supports AND, OR, NOT, XOR, NAND, NOR, and BUFFER gates. NOT and BUFFER are single-input gates; all others take two inputs.
How do I connect gates?
Switch to Connect mode, click the output node (source), then click the input port of the destination gate. Green wires carry a HIGH (1) signal; grey wires carry LOW (0).
How do I toggle an input signal?
Click any input node (the rectangular nodes labelled A, B, etc.) to toggle it between 0 and 1. The circuit updates immediately and signal propagation is shown through wire colours.
Can I delete a wire or gate?
Yes. Switch to Delete mode and click any gate node or wire to remove it. Connected wires are also removed when you delete a gate.
What is a NAND gate?
A NAND gate is a NOT + AND combination. Its output is HIGH unless both inputs are HIGH. NAND gates are universal — any logic function can be built entirely from NAND gates.
Is this suitable for CS coursework?
Yes. The simulator is designed for learning digital logic at A-level and undergraduate level. You can build combinational circuits like half adders, multiplexers, and decoders.
What is a logic gate?
A logic gate is a basic building block of digital circuits that takes one or more binary inputs (0 or 1) and produces a single binary output according to a fixed rule. For example, an AND gate outputs 1 only when all inputs are 1, and a NOT gate inverts its input. In real hardware, gates are built from transistors, but logically they behave exactly as this simulator shows. Combining gates in the right ways is how every digital device performs its functions.
Why are NAND and NOR called universal gates?
Because any logic function can be built using only NAND gates, or only NOR gates. You can construct a NOT gate from a single NAND by connecting both inputs together, then combine NANDs to make AND, OR, and every other gate. This universality means a manufacturer can fabricate a complex chip from one repeated gate type, simplifying design and production. It is a classic result you can verify hands-on in the simulator.
What is a half adder and how do I build one?
A half adder adds two single bits and produces a Sum and a Carry. To build it, wire two input nodes into an XOR gate — its output is the Sum, which is 1 only when the inputs differ — and wire the same two inputs into an AND gate, whose output is the Carry, which is 1 only when both bits are 1. Toggling the inputs through all four combinations gives the correct binary addition, including 1+1 producing Sum 0 and Carry 1 (binary for 2).
What is the difference between combinational and sequential logic?
Combinational logic, which this simulator focuses on, produces outputs that depend only on the current inputs — like adders, multiplexers, and decoders. Sequential logic adds memory: its outputs depend on both current inputs and past state, using feedback loops to store bits (as in latches, flip-flops, and registers). Sequential circuits are how computers remember values and keep time, and they are typically studied after mastering the combinational building blocks you can construct here.
How do logic gates relate to truth tables?
Every logic gate has a corresponding truth table that lists its output for each possible combination of inputs, and any circuit you build here can be described by a combined truth table. A good workflow is to build a circuit in the simulator, toggle through every input combination while recording the outputs, then compare that to the expected truth table — which you can generate with a truth table tool. Matching results confirm your circuit implements the intended logic.