NAND, NOR and XOR Gates
The extended gate set used in real hardware. Learn NAND as the universal gate, NOR as its complement, XOR for arithmetic: and complete truth tables for all three with confidence.
If you could only have one type of logic gate: just one: which would you choose? The engineers who designed the first integrated circuits faced exactly this question. They chose NAND. Not AND, not OR: NAND.
Each of these gates either inverts a familiar gate (NAND, NOR) or introduces new behaviour (XOR). In circuit diagrams, NAND and NOR are drawn with an inversion bubble on the output.
NAND is an AND gate with its output inverted. The only time NAND outputs 0 is when all inputs are 1. Every other combination gives output 1. This is the exact opposite of AND.
| A | B | A AND B | Q = NAND |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 |
Memory tip: NAND is the opposite of AND. Where AND has a single 1 in the output column, NAND has a single 0. In the circuit diagram symbol, it looks like an AND gate but with a small circle (inversion bubble) on the output.
A common question shows a NAND gate symbol and asks for the truth table. Many students write the AND table by mistake. Remember: the circle on the output means NOT is applied. Flip every AND output and you have NAND.
NOR is an OR gate with its output inverted. The only time NOR outputs 1 is when all inputs are 0. Every other combination gives output 0. This is the exact opposite of OR.
| A | B | A OR B | Q = NOR |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 0 |
Memory tip: NOR is the opposite of OR. Where OR has a single 0 in the output column, NOR has a single 1. In the circuit symbol, it looks like an OR gate with an inversion bubble on the output.
NOR is also a universal gate: any circuit can be built from NOR gates alone. This is unlikely to be tested at GCSE level but may appear in a "describe one advantage" style question about NOR or NAND gates.
XOR stands for Exclusive OR. Unlike OR, XOR outputs 1 when exactly one input is 1: not both. When both inputs are the same (00 or 11), XOR outputs 0. It is used in binary addition circuits.
| A | B | Q (A XOR B) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Memory tip: XOR outputs 1 when inputs are different, 0 when the same. You can think of it as "one or the other, but not both." Compare with OR which outputs 1 when A=1, B=1: XOR does not.
Real-world use: XOR is the core of a half adder: the circuit that adds two binary digits. When you add 1 + 1 in binary, the sum digit is 0 (XOR gives 0 when both inputs are 1) and the carry digit is 1 (AND gives 1). XOR and AND together form the simplest building block of CPU arithmetic.
XOR is the most commonly confused gate in the exam. Students write the OR truth table instead. The key difference: OR outputs 1 when A=1, B=1; XOR outputs 0 when A=1, B=1. The symbol for XOR is an OR gate shape with an extra curved line on the input side.
This table shows the output of every gate for every input combination. Use it to check your recall: cover the columns and test yourself.
| A | B | AND | OR | NAND | NOR | XOR |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 |
AND and NAND are opposites. OR and NOR are opposites. XOR is unique: it outputs 1 only when exactly one input is 1. NAND and NOR both have all-1 and all-0 runs in their output: exactly inverted from AND and OR.
A universal gate is one that can replicate every other logic gate by combining copies of itself. Both NAND and NOR are universal gates. In practice, NAND is preferred in manufacturing.
NOT from NAND: Connect both inputs of a NAND gate to the same signal (A = B). The output is NOT A, because NAND(A, A) = NOT(A AND A) = NOT A.
AND from NAND: Add a NOT gate (made from NAND) to the output of a NAND gate. NOT(NAND) = NOT(NOT(AND)) = AND.
OR from NAND: Invert both inputs using two NAND-as-NOT gates, then feed into a NAND gate. By De Morgan's theorem, this produces OR.
Why does this matter? A chip manufacturer only needs to make one type of transistor arrangement. All logic can be achieved by wiring NAND gates differently. This simplifies fabrication enormously.
If asked "What is a universal gate?", define it precisely: a gate from which any other logic gate can be constructed using only that gate type. State that NAND is an example. You may be asked to show how NOT is constructed from NAND: this is the most likely specific requirement.
Use the Logic Gate Builder to place NAND, NOR and XOR gates and verify their truth tables. Then try building a NOT gate using only NAND gates.
Challenge tasks: (1) Place a NAND gate, connect both inputs to the same signal: verify it acts as NOT. (2) Build XOR from NAND gates only (advanced: takes 4 NAND gates). (3) Verify the full XOR truth table by toggling all four input combinations.
Quick quiz: NAND, NOR and XOR
Q1. What is the output of a NAND gate when A = 1 and B = 1?
Q2. A NOR gate has inputs A = 0 and B = 0. What is the output?
Q3. XOR gate: A = 1, B = 1. What is the output?
Q4. Which gate is described as "universal"?
Q5. A NAND gate has inputs A = 0 and B = 1. What is the output?
XOR outputs 1 when inputs are different and 0 when inputs are the same. In binary addition, 1 + 1 = 10 (sum = 0, carry = 1). How do XOR and AND together create a circuit that adds two single bits?