Logic gates
Logic gates
- Boolean logic works with values that are true (1) or false (0).
- A logic gate takes inputs and gives one output by a fixed rule.
- A truth table lists every input combination and its output.
The six gates
- You must know six: NOT, AND, OR, NAND, NOR, XOR.
- NOT has one input; the rest have two. A small circle on the output means inverted (NOT, NAND, NOR).

NOT, AND, OR
- NOT reverses the input. AND is 1 only when both inputs are 1. OR is 1 when 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.)
Practice
An AND gate gives output 1 when:
AND outputs 1 only when every input is 1.
Practice
An OR gate gives output 0 only when:
OR is 1 if at least one input is 1, so it is 0 only when both are 0.
NAND, NOR, XOR
- NAND = opposite of AND; NOR = opposite of OR; 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 |
Practice
A XOR gate gives output 1 when:
XOR (exclusive OR) is 1 when the inputs differ.
Practice
The output of a NAND gate is:
NAND = NOT AND, so its output is the inverse of AND.
Practice
A NOR gate with both inputs 0 gives what output (0 or 1)?
NOR = NOT OR. OR of (0,0) is 0, so NOR is 1. NOR is 1 only when both inputs are 0.
You've got it
Key idea
- 1 = true, 0 = false; a truth table lists every input combination
- AND = both 1 · OR = at least one 1 · NOT = invert
- NAND/NOR = AND/OR with the output inverted (the circle)
- XOR = 1 when the inputs differ