Logic Gate Simulator
Science & Engineering
Simulate AND, OR, NOT, NAND, NOR, XOR, XNOR, and BUFFER logic gates. Toggle inputs and see the output with a truth table.
Output is HIGH only when ALL inputs are HIGH.
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Truth table for AND; the highlighted row matches the current inputs.
How to use this tool
- Select a logic gate type.
- Toggle the input values between 0 (LOW) and 1 (HIGH).
- See the live HIGH/LOW output and the truth table below it.
Logic gate reference
Logic gates are the fundamental building blocks of all digital circuits. Each gate takes one or more binary inputs (0 = LOW / false, 1 = HIGH / true) and produces a single binary output according to a fixed truth table.
| Gate | Symbol | Inputs -> Output | Plain English |
|---|---|---|---|
| AND | ⊓ | 1,1 -> 1; all others -> 0 | Output is 1 only when both inputs are 1. |
| OR | ⊔ | 0,0 -> 0; all others -> 1 | Output is 1 when at least one input is 1. |
| NOT | ◯ | 0 -> 1; 1 -> 0 | Inverts the input (single input only). |
| NAND | ⊓̄ | 1,1 -> 0; all others -> 1 | AND followed by NOT. Universal gate - any circuit can be built from NANDs. |
| NOR | ⊔̄ | 0,0 -> 1; all others -> 0 | OR followed by NOT. Also a universal gate. |
| XOR | ⊕ | same -> 0; different -> 1 | Output is 1 when inputs differ. Used in binary addition. |
| XNOR | ⊙ | same -> 1; different -> 0 | Inverted XOR. Output is 1 when inputs are equal. |
| BUFFER | → | 0 -> 0; 1 -> 1 | Passes its single input through unchanged. |
Theory: composing gates
This tool simulates one gate at a time; it has no circuit canvas or gate wiring. The classic compositions below are reference recipes for understanding how simple Boolean operations work together. You can inspect each gate's individual behavior and truth table here, but the composed circuit itself is not simulated on this page.
Classic compositions (reference)
- Half adder: Use an XOR gate for the sum,
S = A ⊕ B, and an AND gate for the carry,C = A · B. These two outputs represent adding two single binary digits. - Full adder: Let
P = A ⊕ B, thenS = P ⊕ Cin. The carry isCout = (A · B) + (P · Cin), which uses two XOR gates, two AND gates, and an OR gate. This adds two data bits and an incoming carry. - SR latch: Cross-coupled NOR gates form a simple memory element. Feedback lets the pair retain a state; NAND versions also exist, with different active input levels.
- D flip-flop: A clocked storage element captures a data value at a clock edge. It is built from latch logic and timing behavior, so its operation cannot be represented by this single-gate, combinational simulator.
Why logic gates matter
Every microprocessor, memory chip, and digital device is ultimately composed of billions of transistors wired together to behave like logic gates. NAND and NOR gates are called universal because any Boolean function - no matter how complex - can be implemented using only one type of universal gate. The ability to compose simple gates into arbitrarily complex computations is the foundation of all of computing: arithmetic, memory, control flow, and every app running on every device.
Boolean algebra laws
Boolean algebra provides rules for simplifying logic circuits before building them - fewer gates means lower cost, less power, and faster switching:
| 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 |
| Distributive | A(B + C) = AB + AC | A + BC = (A+B)(A+C) |
| De Morgan's | NOT(A · B) = Ā + B̄ | NOT(A + B) = Ā · B̄ |
De Morgan's theorems are especially useful: they let you replace NAND gates with OR gates (and vice versa) by pushing the NOT inside. This is how circuits using only NAND gates can implement OR and NOT functions.
Universal gates
NAND and NOR are each individually universal - any logic circuit can be built from only NAND gates, or from only NOR gates. This has major practical importance:
- Early integrated circuits (e.g., TTL 7400 series) were manufactured as all-NAND or all-NOR chips. Designers implemented every other gate type using combinations of NANDs, reducing the number of distinct ICs needed in a design.
- Modern CMOS fabrication naturally produces NAND and NOR structures with minimum transistor count - 4 transistors for NAND vs. 6 for AND - making universal gates the most area-efficient building blocks.
Frequently asked questions
What is a logic gate?
A logic gate is a basic building block of digital circuits that performs a Boolean operation on one or more binary inputs to produce a single output.
Can I wire multiple gates together here?
No. This simulator operates one selected gate at a time and does not provide a canvas or gate wiring. Use the Truth Table Generator for arbitrary Boolean expressions and multi-variable tables.
Related tools
- Truth TableGenerate a tabular view of Boolean outputs for a logical expression.
- Bitwise CalculatorWork through binary operations that the simulated gates implement at bit level.
- Number Base ConverterTranslate binary input and output patterns into hexadecimal or decimal.
- NE555 CalculatorDesign a clock source for stepping a simple digital circuit.