Use this interactive logic gates simulator to test binary inputs, compare outputs, and see the matching boolean expression and truth table for each gate.
How to use the logic gates simulator
Choose a gate
Select AND, OR, NOT, NAND, NOR, XOR, or XNOR. The circuit rule changes instantly.
Switch inputs
Turn input A and input B on or off. For NOT, only input A is needed.
Read the expression
The boolean expression updates automatically for the selected logic gate.
Check the truth table
The truth table highlights the row that matches the current input values.
Core idea
Logic gates are the building blocks of digital circuits. Each gate follows a rule that changes one or two binary inputs into one binary output. A boolean expression writes the rule in symbols, and a truth table lists every possible result.
Boolean expressions used
| Gate | Boolean expression | Meaning |
|---|---|---|
| AND | Y = A · B | Output is 1 only when A and B are both 1. |
| OR | Y = A + B | Output is 1 when at least one input is 1. |
| NOT | Y = Ā | Output is the opposite of A. |
| NAND | Y = (A · B)̄ | Output is the opposite of AND. |
| NOR | Y = (A + B)̄ | Output is the opposite of OR. |
| XOR | Y = A ⊕ B | Output is 1 when the inputs are different. |
| XNOR | Y = A ⊙ B | Output is 1 when the inputs are the same. |
What students should notice
Binary values
Digital circuits use 0 and 1. These can also be read as false and true, or off and on.
Opposite gates
NAND is the inverse of AND, NOR is the inverse of OR, and XNOR is the inverse of XOR.
Truth tables
A two-input gate has four possible input rows: 00, 01, 10, and 11.
NOT is different
The NOT gate has one input, so its truth table has only two rows.
Frequently asked questions
What are logic gates?
Logic gates are basic digital circuit parts that use binary inputs to create a binary output.
What is a boolean expression?
A boolean expression is a symbolic rule for a logic gate, such as Y = A · B for an AND gate.
Why does the NOT gate use only one input?
NOT is an inverter. It changes one input into its opposite value, so it does not need a second input.
What is the difference between XOR and XNOR?
XOR is 1 when the inputs are different. XNOR is 1 when the inputs are the same.