Logic Gate Simulator
Build and simulate digital logic circuits online with AND, OR, NOT, NAND, NOR, XOR and XNOR gates. Get instant truth tables, animated circuit diagrams, canonical Boolean forms and step-by-step evaluation.
Your ad blocker is preventing us from showing ads
MiniWebtool is free because of ads. If this tool helped you, please support us by going Premium (ad‑free + faster tools), or allowlist MiniWebtool.com and reload.
- Allow ads for MiniWebtool.com, then reload
- Or upgrade to Premium (ad‑free)
About Logic Gate Simulator
The Logic Gate Simulator is a free online sandbox for digital-logic circuits. Type any Boolean expression using AND, OR, NOT, NAND, NOR, XOR and XNOR gates and the simulator immediately parses it into a gate-level circuit, draws the diagram on canvas, fills in the full truth table for up to 5 inputs, and lets you flip each input with a tap to watch the signal propagate in real time. It is designed for students learning digital electronics, engineers prototyping combinational circuits, and anyone who wants to test a Boolean expression before committing it to breadboard, schematic or HDL code.
What is a logic gate?
A logic gate is the fundamental building block of a digital circuit: an electronic element that takes one or more binary inputs (each either 0 or 1, often called LOW and HIGH) and produces a single binary output determined by a fixed Boolean function. Logic gates are implemented in silicon as transistor networks — typically CMOS — and are the physical realisation of Boolean algebra. Every computer, smartphone, and digital controller is ultimately a billion-scale composition of these seven basic gates.
The seven basic gates at a glance
↔ Swipe sideways on mobile to compare every output state.
| Gate | Symbol | Equation | A=0B=0 | A=0B=1 | A=1B=0 | A=1B=1 |
|---|---|---|---|---|---|---|
| AND | A · B | Y = A · B | 0 | 0 | 0 | 1 |
| OR | A + B | Y = A + B | 0 | 1 | 1 | 1 |
| NOT | ¬A | Y = ¬A | A=0 → Y=1 | A=1 → Y=0 | ||
| NAND | ¬(A · B) | Y = ¬(A · B) | 1 | 1 | 1 | 0 |
| NOR | ¬(A + B) | Y = ¬(A + B) | 1 | 0 | 0 | 0 |
| XOR | A ⊕ B | Y = A ⊕ B | 0 | 1 | 1 | 0 |
| XNOR | ¬(A ⊕ B) | Y = ¬(A ⊕ B) | 1 | 0 | 0 | 1 |
AND gate
The output is 1 only when all inputs are 1 — think of it as a series connection of switches. Used to enforce multiple conditions, mask bits, and implement logical conjunction. Industry part: 7408 (quad 2-input AND).
OR gate
The output is 1 when at least one input is 1 — think of it as a parallel connection of switches. Used for alarm circuits, bit setting, and logical disjunction. Industry part: 7432.
NOT gate (inverter)
A single-input gate that simply flips 0 to 1 and 1 to 0. Used to negate signals, generate complement lines, and as the active element of CMOS. Industry part: 7404.
NAND gate
The negation of AND — outputs 0 only when all inputs are 1. NAND is a universal gate: any Boolean function can be built using NAND gates alone, which is why NAND dominates mass-produced CMOS. Industry part: 7400.
NOR gate
The negation of OR — outputs 1 only when every input is 0. Also a universal gate. Famously the core gate of the Apollo Guidance Computer, built entirely from 3-input NOR gates. Industry part: 7402.
XOR gate
Exclusive OR outputs 1 when an odd number of inputs are 1. Critical in binary adders (the sum bit), parity generators, comparators, and the AES round function. Industry part: 7486.
XNOR gate
The negation of XOR — outputs 1 when the inputs are equal. Often called an equivalence gate and used as a one-bit comparator. Industry part: 74266.
How to use this simulator
- Type or build your expression in the input box at the top. You can type directly or tap the keypad buttons for variables and operators. Both word syntax (AND, OR, NOT) and symbolic syntax (&, |, !, ^) are accepted.
- Click Simulate. The simulator parses your expression, verifies the syntax, extracts the variables, and computes the output for every combination (up to 32 rows for 5 inputs).
- Flip the input toggles above the circuit diagram. Each toggle is a clickable button cycling between 0 and 1; the circuit updates in real time, highlighting active wires in red and lighting the green output LED when Y = 1.
- Read the truth table. Every possible input combination is listed alongside its output; the row matching the current toggle state is highlighted.
- Check the canonical forms. The simulator writes out the Sum-of-Products and Product-of-Sums equivalents — the starting point for Karnaugh-map minimization or Quine–McCluskey reduction.
- Walk through the evaluation. The step-by-step panel shows how the expression reduces gate by gate for one sample input, which is especially useful for debugging nested expressions.
Accepted expression syntax
- Variables: single letters A through Z (lowercase auto-capitalised). Up to 5 distinct variables per expression.
- Constants:
0,1, orTRUE/FALSE. - Word operators:
AND,OR,NOT,NAND,NOR,XOR,XNOR(case-insensitive). - Symbolic operators:
&or*for AND,|or+for OR,!or~for NOT,^for XOR. - Grouping: parentheses
( )may be nested freely. - Precedence (highest to lowest):
NOT>AND/NAND>XOR/XNOR>OR/NOR. Use parentheses when in doubt.
Why these presets are worth exploring
Majority function (3-input)
(A AND B) OR (A AND C) OR (B AND C) — the output is 1 whenever at least two of the three inputs are 1. This is the heart of triple-modular-redundant (TMR) voting circuits used in aerospace and fault-tolerant computing.
2-to-1 multiplexer
(A AND NOT S) OR (B AND S) — when the select line S is 0 the output forwards A; when S is 1 it forwards B. Multiplexers are the routing fabric of data-paths and the FPGA look-up table is literally a cascade of multiplexers.
3-bit parity
A XOR B XOR C — outputs 1 when an odd number of inputs are 1. Parity checkers are used in RAM error detection, UART communication and RAID storage.
Half-adder
The sum bit of a 1-bit adder is A XOR B; the carry bit is A AND B. Chaining these produces the ripple-carry adder at the arithmetic heart of every CPU.
Boolean algebra essentials
Core identities
- Identity: A + 0 = A; A · 1 = A
- Null: A + 1 = 1; A · 0 = 0
- Idempotent: A + A = A; A · A = A
- Complement: A + ¬A = 1; A · ¬A = 0
- Double negation: ¬(¬A) = A
- De Morgan's laws: ¬(A · B) = ¬A + ¬B; ¬(A + B) = ¬A · ¬B
- Distributive: A · (B + C) = (A · B) + (A · C)
- Absorption: A + (A · B) = A; A · (A + B) = A
Sum-of-Products (SOP)
Take every row where the output is 1, write each as a product of variables (uncomplemented for 1, complemented for 0), and OR them together. Every Boolean function has a unique SOP — the simulator prints yours automatically.
Product-of-Sums (POS)
The dual of SOP: take each row where the output is 0, write it as a sum with complemented 1-inputs and plain 0-inputs, then AND all the factors. Useful when the function has more 1s than 0s.
Real-world applications of logic gates
- Arithmetic logic units (ALUs): adders, subtractors, comparators inside every CPU.
- Memory cells: SR, D, JK, and T flip-flops are all compositions of NAND or NOR gates.
- Encoders and decoders: translate between one-hot and binary representations in address decoders and display drivers.
- Control logic: finite-state machines, traffic-light controllers, vending machines.
- Error detection: parity checkers, CRC engines, Hamming code encoders.
- Cryptography: XOR is the core operation in stream ciphers and block-cipher round functions.
- FPGAs: look-up tables implement arbitrary gate networks by storing a truth table directly.
Tips for reading the circuit diagram
- Inputs are circular terminals on the left, labelled with the variable name and current value.
- Gates use the standard ANSI/IEEE symbols: D-shape for AND, curved shield for OR, triangle-plus-bubble for NOT, and so on. The small bubble at the output marks the negated variants (NAND, NOR, XNOR).
- Wires are colour-coded: red (with a subtle glow) when carrying 1, blue when carrying 0.
- Output appears at the right edge as a filled green circle when Y = 1, dim grey when Y = 0.
Frequently asked questions
What operators can I use in the Boolean expression?
The simulator accepts both word operators (AND, OR, NOT, NAND, NOR, XOR, XNOR) and symbolic operators. Use & or * for AND, | or + for OR, ! or ~ for NOT, and ^ for XOR. Variables are single letters A through Z (case-insensitive), and 0 and 1 are accepted as constants. Parentheses may be nested freely to control evaluation order.
What is the difference between NAND and NOR gates?
NAND (NOT AND) outputs 1 whenever the AND of its inputs is 0 — that is, in every case except when all inputs are 1. NOR (NOT OR) outputs 1 only when every input is 0. Both are called universal gates because any Boolean function can be built using only NAND gates, or only NOR gates, which is why they are the building blocks of CMOS integrated circuits.
Why does XOR produce 1 for odd numbers of 1-inputs?
XOR (exclusive OR) outputs 1 when its two inputs differ. Chained XORs act as a parity checker: the output is 1 when the total number of 1 inputs is odd, and 0 when it is even. This is why XOR gates are used in parity generators, error detection circuits and in the sum output of binary adders.
How many variables can the simulator handle?
The simulator supports up to 5 distinct variables, giving a maximum of 32 truth-table rows. This limit keeps the full truth table readable and the circuit diagram legible. If you paste an expression with more than 5 variables, the tool will ask you to reduce it.
What is the Sum-of-Products form?
Sum-of-Products (SOP) is a canonical Boolean form where the expression is written as an OR of AND terms. Each AND term corresponds to a truth-table row whose output is 1. SOP is the direct way to translate a truth table back into a Boolean expression and is the starting point for Karnaugh-map and Quine–McCluskey minimization.
Can I use the tool to design real hardware?
Yes — the simulator is useful for learning digital logic, homework problems, breadboard prototyping with 74-series ICs, and early design exploration for FPGA or ASIC projects. The circuit diagram shows gate counts and structure, which helps you estimate chip count or look-up-table utilization before committing to a schematic editor.
Further Reading
- Logic gate — Wikipedia
- Boolean algebra — Wikipedia
- Karnaugh map — Wikipedia
- De Morgan's laws — Wikipedia
- CMOS — Wikipedia
Reference this content, page, or tool as:
"Logic Gate Simulator" at https://MiniWebtool.com/logic-gate-simulator/ from MiniWebtool, https://MiniWebtool.com/
by miniwebtool team. Updated: Apr 20, 2026
Related MiniWebtools:
Electronics Tools:
- Battery Life Calculator New
- Resistor Color Code Calculator New
- Ohm's Law Calculator New
- Voltage Drop Calculator New
- PCB Trace Width Calculator New
- Wire Gauge Calculator New
- LED Resistor Calculator New
- Voltage Divider Calculator New
- Parallel Resistor Calculator New
- Capacitor Calculator New
- 555 Timer Calculator New
- Transformer Calculator New
- RC Time Constant Calculator New
- Power Factor Calculator New
- Decibel (dB) Calculator New
- Impedance Calculator New
- Resonant Frequency Calculator New
- Logic Gate Simulator New