Topic 10 · Boolean logic
Logic gates and truth tables
The six logic gates, NOT, AND, OR, NAND, NOR, and XOR, with their symbols and truth tables.
Gates make decisions with 1s and 0s
A logic gate is an electronic component that takes one or two binary inputs and produces one binary output. 1 means on (TRUE), 0 means off (FALSE). Every calculation a CPU does is built from millions of these gates.
A truth table lists every possible combination of inputs and the output for each. With 2 inputs there are 4 rows; with 3 inputs there are 8.
Try every gate
Pick a gate, then click the inputs (or a row of the truth table). Highlighted wires carry a 1.
| A | Out |
|---|---|
| 0 | 1 |
| 1 | 0 |
The rules in words
| Gate | Output is 1 when... | Expression |
|---|---|---|
| NOT | the input is 0 (it flips the input) | X = NOT A |
| AND | both inputs are 1 | X = A AND B |
| OR | at least one input is 1 | X = A OR B |
| NAND | NOT AND: the inputs are not both 1 | X = A NAND B |
| NOR | NOT OR: neither input is 1 | X = A NOR B |
| XOR | the inputs are different | X = A XOR B |
Exam tip. A small circle (bubble) on a gate's output means NOT. That is the only difference between AND and NAND, or OR and NOR.
Key terms
- Logic gate
- A component that performs a Boolean operation on binary inputs.
- Truth table
- A table showing the output for every combination of inputs.
- XOR
- Exclusive OR: outputs 1 only when the inputs are different.
Check yourself
Which gate outputs 0 only when both inputs are 1?Show answer
NAND.
What is 1 XOR 1?Show answer
0: the inputs are the same.
How many rows does a truth table with 3 inputs need?Show answer
2³ = 8 rows.
References used to build these lessons
We used these official documents as references when building this course's lessons. They are the sources for the syllabus structure and course requirements.
Cambridge International · 0478 · Exams 2026–2028