Logic Gate Simulator — Build and Test Digital Circuits Online
Logic gates are the fundamental building blocks of every digital computer. This guide covers all seven gate types, boolean algebra, and how to build real circuits using the free online logic gate simulator.
The 7 Logic Gates You Need to Know
| Gate | Symbol | Output is HIGH when... | Boolean |
|---|---|---|---|
| AND | D-shape with flat back | Both inputs are HIGH | A · B |
| OR | Curved D-shape | At least one input is HIGH | A + B |
| NOT | Triangle with bubble | Input is LOW (inverts) | Ā |
| XOR | OR with extra curve | Inputs are different | A ⊕ B |
| NAND | AND with bubble | NOT both inputs HIGH | NOT(A · B) |
| NOR | OR with bubble | Both inputs are LOW | NOT(A + B) |
| BUFFER | Triangle without bubble | Input is HIGH (copies) | A |
How to Use the Logic Gate Simulator
- Open the Logic Gate Simulator
- Click a gate type button (AND, OR, NOT, etc.) to add it to the canvas
- Switch to Connect mode and click an output port, then an input port to wire gates together
- Click input nodes (A, B) to toggle them between 0 and 1 — green wires carry HIGH signal
- Switch to Delete mode to remove gates or wires
Building a Half Adder
A half adder adds two single bits and produces a Sum and a Carry output. It requires exactly two gates:
- Sum output: XOR gate (A XOR B)
- Carry output: AND gate (A AND B)
Connect inputs A and B to both an XOR gate (for Sum) and an AND gate (for Carry). Test all four input combinations to verify: 0+0=0 carry 0, 0+1=1 carry 0, 1+0=1 carry 0, 1+1=0 carry 1.
Universal Gates: NAND and NOR
Both NAND and NOR are universal gates — any logic circuit can be built using only one type. This is practically important for chip manufacturing, where using a single gate type simplifies fabrication.
Building AND from NAND gates
AND = NAND followed by a NOT (which is itself a NAND with both inputs tied together). Three NAND gates can implement any two-input AND gate.
De Morgan's theorem verification
De Morgan's laws state: NOT(A AND B) = (NOT A) OR (NOT B). Build this in the simulator: compare a NAND gate to a circuit with two NOT gates feeding an OR gate. Both should produce identical outputs for all input combinations.
Boolean Algebra Reference
| Law | AND form | OR form |
|---|---|---|
| Identity | A · 1 = A | A + 0 = A |
| Null | A · 0 = 0 | A + 1 = 1 |
| Idempotent | A · A = A | A + A = A |
| Complement | A · Ā = 0 | A + Ā = 1 |
| De Morgan | NOT(A·B) = Ā+B̄ | NOT(A+B) = Ā·B̄ |
Common Questions
What is the difference between XOR and OR?
OR is HIGH when at least one input is HIGH (including when both are HIGH). XOR (exclusive OR) is HIGH only when exactly one input is HIGH — it outputs LOW when both inputs are HIGH. XOR is used in binary addition and parity checking.
Why is NAND more commonly used than AND in hardware?
NAND gates are slightly faster to fabricate in CMOS technology and consume less power. Since any logic can be built from NAND gates alone, chip designers often standardise on them for efficiency.
Can I simulate combinational and sequential circuits?
The simulator supports combinational logic (no memory, output depends only on current inputs). Sequential circuits (flip-flops, registers, counters) require feedback loops with clock signals, which are beyond the scope of this tool.
Try the Logic Gate Simulator
Build and test your own digital circuits in the Logic Gate Simulator — drag-and-drop gates, wire them together, and toggle inputs in real time.
Open Logic Gate Simulator