Logic gates
| English | Chinese | Pinyin |
|---|---|---|
| logic gate | 逻辑门 | luó jí mén |
| Boolean | 布尔 | bù ěr |
| truth table | 真值表 | zhēn zhí biǎo |
The building blocks of logic
- A logic gate 逻辑门 is a tiny circuit that does one Boolean 布尔 operation.
- Every input and output is 0 (false) or 1 (true).
- Learn each gate's symbol, its function, and its truth table 真值表.
The six gate symbols
- You must recognise all six: NOT, AND, OR, NAND, NOR, XOR.
- NAND is "NOT AND", NOR is "NOT OR" — the little circle (bubble) means "invert the output".

The circuit symbols for the six gates — the bubble on NAND, NOR and XOR means "invert the output".
Logic gates
output from the truth table
Toggle A and B through a gate and watch the truth table row light up.
NOT, AND, OR
- NOT flips the input. AND is 1 only if all inputs are 1. OR is 1 if at least one input is 1.
| A | B | A AND B | A OR B |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 |
(NOT: 0→1, 1→0.)
A NOT gate outputs 1 when its input is 0.
NOT inverts: 0 → 1 and 1 → 0.
An AND gate outputs 1 when:
AND outputs 1 only if every input is 1; otherwise 0.
An OR gate outputs 0 only when:
OR is 1 if at least one input is 1, so it is 0 only when every input is 0.
NAND, NOR, XOR
- NAND = NOT AND (0 only when all inputs are 1). NOR = NOT OR (1 only when all inputs are 0). XOR = 1 when the inputs are different.
| A | B | A NAND B | A NOR B | A XOR B |
|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 0 | 0 |
- The XOR gate is also called EOR; a logic expression can be written from a truth table.
A XOR gate outputs 1 when:
XOR (exclusive OR) is 1 when the inputs differ (0,1 or 1,0) and 0 when they are the same.
A NAND gate outputs 0 only when:
NAND = NOT AND, so it is 0 exactly when AND would be 1 (all inputs 1), and 1 otherwise.
A NOR gate with both inputs 0 outputs what value (0 or 1)?
NOR = NOT OR. OR of (0,0) is 0, so NOR is 1. NOR is 1 only when all inputs are 0.
You've got it
- a gate does one Boolean operation on 0/1 inputs
- AND = all 1s · OR = any 1 · NOT = invert
- NAND/NOR = AND/OR with the output inverted (the bubble)
- XOR = 1 when the inputs differ