Logic gates and truth tables: AND, OR and NOT
AND needs both inputs on, OR needs at least one, and NOT flips its input. Combine them and a truth table shows every outcome.
By the end you can
- State what AND, OR and NOT gates do and recognise their symbols
- Write the truth table for each gate from memory
- Complete a truth table for a logic diagram with more than one gate
- Turn a real-life rule into a Boolean expression
Key words
- Boolean
- A value that can only be true or false, written as 1 or 0.
- Logic gate
- A part of a circuit that takes one or two inputs and gives one output by following a rule.
- AND
- Gives 1 only when both inputs are 1. Also called conjunction.
- OR
- Gives 1 when either input is 1, or both. Also called disjunction.
Every decision a processor makes comes down to tiny circuits that follow simple true-or-false rules. Three of those rules, AND, OR and NOT, let you build and read any logic diagram on the course.
True and false as 1 and 0
Boolean logic works with only two values: true and false. In circuits and truth tables, 1 means true, or on, and 0 means false, or off. A logic gate takes its inputs, applies one rule, and gives a single output.
The same rules appear in programming. A condition like "score is above 50 and lives are above 0" is an AND, so the code inside only runs when both parts are true.
The AND gate
An AND gate gives 1 only when both of its inputs are 1. Its symbol looks like a capital D: a flat back with a rounded front.
Swipe the table sideways to see every column →
| A | B | A AND B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Imagine a machine that only runs when its lid is closed and its start button is pressed. Both conditions must be true before anything happens.
The OR gate
An OR gate gives 1 when either input is 1, or both are. Its symbol has a curved back and a pointed front, a little like a shield on its side.
Swipe the table sideways to see every column →
| A | B | A OR B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
A doorbell with a button at the front door and one at the back door works like this. Either button rings the bell.
The NOT gate
A NOT gate has only one input, and its output is always the opposite. Its symbol is a triangle with a small circle on its point, and the circle is the part that means "not".
Swipe the table sideways to see every column →
| A | NOT A |
|---|---|
| 0 | 1 |
| 1 | 0 |
Combining gates
Real circuits join gates together, with the output of one feeding the input of the next. Take the expression P = (A AND B) OR NOT C. With three inputs there are 2 × 2 × 2 = 8 rows, so list the inputs counting up in binary from 000 to 111.
Adding a column for each gate keeps the work tidy. Fill in A AND B first, then NOT C, then OR those two columns together:
Swipe the table sideways to see every column →
| A | B | C | A AND B | NOT C | P |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 | 1 |
The number of rows doubles with every input you add. One input needs 2 rows, two inputs need 4, and three inputs need 8.
Turning a rule into logic
Exam questions often describe a situation in words and ask for the expression or the diagram. Pick out each condition, give it a letter, and look for the joining words. "And" becomes AND, "or" becomes OR, and "not" or "unless" becomes NOT.
For example, a greenhouse heater (H) comes on when it is cold (C) and the door is not open (D). That gives H = C AND NOT D. Check it with one row: cold, with the door shut, gives C = 1 and D = 0. NOT D is 1, and 1 AND 1 is 1, so the heater comes on.
You can test each gate, and build a two-gate circuit like the one above, with the logic gates tool.
Check your understanding
Have a go first, then open each answer to check.
1.What is the output of an AND gate when its inputs are 1 and 0?
Show the answer
0. AND only gives 1 when both inputs are 1.
2.How many rows does a truth table with four inputs need?
Show the answer
16, because 2 × 2 × 2 × 2 = 16.
3.Give the value of Q = NOT (A OR B) when A = 0 and B = 1.
Show the answer
0. A OR B is 1, and NOT 1 is 0.
4.An alarm (S) sounds when a window is open (W) or a door is open (D), but only when the system is set (A). Write the expression.
Show the answer
S = (W OR D) AND A.
5.Which gate has only one input?
Show the answer
NOT. It gives the opposite of its single input.
Key words
- Boolean
- A value that can only be true or false, written as 1 or 0.
- Logic gate
- A part of a circuit that takes one or two inputs and gives one output by following a rule.
- AND
- Gives 1 only when both inputs are 1. Also called conjunction.
- OR
- Gives 1 when either input is 1, or both. Also called disjunction.
- NOT
- Has one input and gives the opposite. Also called negation.
- Truth table
- A table showing the output for every possible combination of inputs.
- Logic diagram
- A drawing of gates joined together, with inputs on the left and the output on the right.
Sources
The curriculum statements and specification points on this page come from these documents, read on 2 December 2026. Specifications are updated from time to time, so check your exam board's current version.
Spotted something wrong or out of date? Tell us and we will correct it.
More for GCSE and Key stage 4
- Knowledge organiserAlgorithmsSearching and sorting algorithms: linear, binary, bubble, insertion and mergeTwo ways to search and three ways to sort. Know the steps of each, what each needs, and apply it to a short list by hand.4 min read · Years 10 and 11
- Knowledge organiserData and binaryBinary, denary and hexadecimal: converting, adding and shiftingEvery number from 0 to 255 fits in 8 bits. Learn the place values and you can convert to denary or hex, add, and shift.4 min read · Years 10 and 11