Click inputs A and B to toggle · Select a gate type · Watch truth table update live
| A | B | Q |
|---|
Toggle inputs and watch 8 types of logic gates — AND, OR, NOT, XOR, NAND, NOR, XNOR and Buffer — compute outputs in real time. A live truth table updates alongside animated signal pulses.
Each gate implements a Boolean function: AND outputs 1 only when both inputs are 1; OR outputs 1 when either is 1; XOR outputs 1 when inputs differ. NAND and NOR are universal — any Boolean circuit can be built using only NAND (or only NOR) gates.
Switch between gate types using the selector. Toggle inputs A and B by clicking. Watch the animated pulse travel through the gate symbol and the truth table highlight the current row.
NAND gates are called 'universal' because any other gate can be constructed from NAND alone. The Apollo Guidance Computer used approximately 5,600 NOR gates to navigate astronauts to the Moon.
This interactive tool models the eight fundamental logic gates of digital electronics — AND, OR, NOT, XOR, NAND, NOR, XNOR and Buffer. Each gate evaluates a Boolean function of its inputs A and B, where every signal is either 0 (low) or 1 (high). The simulator computes the gate output Q instantly, animates the signal pulse travelling along the wires when a line is high, and keeps a live truth table in step so you can map every input combination to its result.
Each gate applies a bitwise Boolean operation: AND uses a&b, OR uses a|b, XOR uses a^b, while NAND, NOR and XNOR invert those results, and NOT and Buffer act on a single input. The canvas draws the standard IEEE gate symbol — including the inversion bubble on the negating gates — and the output Q updates the moment any input changes.
Pick one of the eight gate buttons (AND, OR, NOT, XOR, NAND, NOR, XNOR, BUF). Click the circular A and B toggles to flip each input between 0 and 1. For single-input gates (NOT and Buffer) the B input dims out automatically. The output panel shows Q, the gate name and its Boolean expression, and the truth table highlights the row matching your current inputs.
NAND and NOR are described as universal gates because any Boolean circuit can be built from copies of just one of them. The Apollo Guidance Computer that helped land humans on the Moon was constructed almost entirely from around 5,600 three-input NOR gates.
A logic gate is the basic building block of a digital circuit. It takes one or more binary inputs (each 0 or 1) and produces a single binary output according to a fixed Boolean rule. Combining many gates lets a computer perform arithmetic, store data and make decisions.
Every gate follows a Boolean function. AND outputs 1 only when both A and B are 1; OR outputs 1 when at least one input is 1; XOR outputs 1 only when the inputs differ. NAND, NOR and XNOR simply invert the AND, OR and XOR results, while NOT and Buffer act on a single input.
The gate buttons choose which Boolean operation is applied. The A and B toggles set each input to 0 or 1 with a click. When you select a single-input gate such as NOT or Buffer, the B toggle is greyed out because it has no effect on the result.
It is logically accurate: the outputs exactly match the ideal Boolean truth tables for each gate. It is an idealised model, however, and does not simulate real-world effects such as propagation delay, voltage thresholds, fan-out limits or power consumption found in physical transistor circuits.
A gate is universal if every other logic function can be reproduced using only copies of it. Both NAND and NOR satisfy this, so an entire processor could in principle be built from a single gate type. This property greatly simplifies chip manufacturing, since one standardised gate can implement any circuit.