22 min read
NAND, NOR and XOR Gates
Combined gates: NOT-AND, NOT-OR and exclusive OR — plus why NAND and NOR are called universal gates.
All Six Symbols
NAND — NOT AND
A NAND gate is an AND gate followed by a NOT. Its output is the opposite of AND: it is 0 only when all inputs are 1.
Expression: . The bar goes over the whole of .
The NAND gate
| A | B | Q |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Boolean expression:
NOR — NOT OR
A NOR gate is an OR gate followed by a NOT. Its output is 1 only when all inputs are 0.
Expression: .
The NOR gate
| A | B | Q |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
Boolean expression:
XOR — Exclusive OR
An XOR gate gives 1 when the inputs are different, and 0 when they are the same. It is like OR, except it excludes the case where both are 1.
Expression: , which is the same as .
An XNOR gate is XOR followed by NOT: 1 when the inputs are the same. Its expression is .
Logic gate explorer
| A | B | Q |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Boolean expression:
Six Gates in One Table
| Truth tables for all two-input gates | |||||||
|---|---|---|---|---|---|---|---|
OR vs XOR
| OR | XOR |
|---|---|
| 1 if at least one input is 1 | 1 if the inputs are different |
| 1, 1 → 1 | 1, 1 → 0 |
| "Tea or coffee?" — you may have both | "Tea or coffee?" — pick exactly one |
Universal Gates
NAND and NOR are called universal gates: you can build every other gate from only NAND gates (or only NOR gates). For example, a NAND gate with both inputs joined together acts as a NOT gate. Chip makers like this because a whole circuit can be made from one type of gate.
Practice
Choose all that apply.
More lessons in Boolean Algebra and Logic Gates · Next: Truth Tables for Circuits · Previous: AND, OR and NOT Gates
