Digital logic is built from a small set of gates that each implement a Boolean function of one or two inputs. This reference shows the truth tables for all seven basic gates and lets you toggle the inputs to see every output live.
How it works
Each gate maps input bits to an output bit:
- AND —
A · B, output 1 only when both inputs are 1. - OR —
A + B, output 1 when at least one input is 1. - NOT —
¬A, the inverter; output is the opposite of A. - NAND —
¬(A · B), AND followed by an inverter. - NOR —
¬(A + B), OR followed by an inverter. - XOR —
A ⊕ B, output 1 only when the inputs differ. - XNOR —
¬(A ⊕ B), output 1 only when the inputs are equal.
NAND and NOR are universal: any circuit can be built from one of them alone.
Tips and notes
- XOR is the sum bit of a half-adder; AND is its carry bit.
- XNOR is a single-bit equality check, used in comparators.
- The full 4-row truth table below covers every
(A, B)combination so you can cross-check a circuit by hand.