GCSE · Computer Science · AQA · Spec 8525

XOR logic gate

'Tea or coffee?' usually means pick one. Ask for both and you've broken the deal. There's a logic gate that takes that 'not both' completely seriously. It's called XOR.

Computer Science · Logic gates

Four input pairs, one XOR gate

A logic gate is an electronic component that carries out a logical operation. Every input and output is True or False, written 1 (high voltage) or 0 (low voltage). XOR has two inputs, A and B, and one output, Q.

At every row, ask one question: are A and B different? Press Next to move the highlight down the table.

XORQ = A XOR B, also written Q = A ⊕ Bgate
ABQ
000
011
101
110
A=0, B=0 → Q = 0

Output

 

Step 1: Both inputs are 0. They match, so Q = 0.

1 / 5

Look at the two rows where Q = 1. What do their inputs have in common?

Step 1 of 5: Both inputs are 0. They match, so Q = 0..

Exam line: XOR: the output is 1 when exactly one input is 1, and 0 when both inputs are the same.
Watch out: A = 1, B = 1 gives 0, not 1. That one row is what makes XOR different from OR.

Computer Science · Logic gates

OR or XOR: where do they disagree?

OR outputs 1 when either input or both inputs are 1. XOR outputs 1 when the inputs are different. For each input pair, tick every gate that would output 1, then check.

  • A OR outputs 1
  • B XOR outputs 1
  1. A = 0, B = 0
  2. A = 0, B = 1
  3. A = 1, B = 0
  4. A = 1, B = 1

Computer Science · Logic gates

Is it OR, or is it XOR?

Which gate does each description or expression belong to?

Still to sort

OR gate (0)

The plain OR shape, or the word OR.

Where the line is: No extra line on the input side. Add one and it becomes XOR.

XOR gate (0)

Exclusive OR: the OR shape with something extra.

Where the line is: An extra curved line across the input side, or the XOR / ⊕ notation.

6 of 6 still to sort.

Each gate has its own symbol for circuit diagrams. These two are near-twins, so the detail matters.

Exam line: XOR symbol = OR symbol + an extra curved line across the input side. In expressions, A XOR B and A ⊕ B are both common.
Watch out: The ⊕ sign has a circle round it. That circle is the clue: it marks XOR.

Computer Science · Logic gates

An XOR gate inside a circuit

A and B go into an XOR gate, giving P = A XOR B. P then goes into a NOT gate, which has one input and flips it: 0 becomes 1 and 1 becomes 0. The NOT gate's output is Q. Complete the truth table: find P and Q for every row.

  1. Two inputs, so four rows: A B = 0 0, 0 1, 1 0, 1 1. Work out P first, then Q.Always start with the gate nearest the inputs.
  2. Row 0 0: the inputs match, so P = 0. NOT flips it: Q = 1.
  3. missing step
Which line is step 3?

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

Two inputs, one output, one question: are the inputs different? By the end you'll know the single row that separates XOR from OR.

What you need to know

  • A logic gate is an electronic component that carries out a logical operation.
  • Its inputs and outputs are True or False, written 1 (high voltage) or 0 (low voltage).
  • Each gate has its own symbol for circuit diagrams and its own truth table.
  • XOR, short for exclusive OR, has two inputs and one output.
  • The output is 1 when exactly one input is 1, and 0 when both inputs are the same.
  • So there's one test to run: are the inputs different? Yes gives 1. No gives 0.
  • Have a goRun the test twice. A = 1, B = 0. Then A = 0, B = 0. What does XOR output each time?

    1, then 0.

    1 and 0 are different, so the output is 1. Two 0s match, so the output is 0: no input at 1 means nothing to switch it on either.

  • Its truth table: 0 0 gives 0, 0 1 gives 1, 1 0 gives 1, 1 1 gives 0.
  • OR and XOR disagree only when both inputs are 1: OR gives 1, XOR gives 0.
  • Have a goYour mate writes XOR's bottom row as 1 1 → 1 and says, 'Relax, XOR is basically OR.' Which gate's table did that row actually come from?

    OR's. XOR gives 0 there.

    Both inputs are 1, so they match and XOR outputs 0. Only OR counts the both-1 case as a yes, and that's the one row where 'basically OR' falls apart.

  • XOR's symbol: the OR symbol plus an extra curved line across the input side. Written A XOR B or A ⊕ B.
  • Inside a bigger circuit, XOR's output can feed another gate: work out the XOR column first.
  • Have a goP = A XOR B, and then P goes into a second XOR gate with a new input C. If A = 1, B = 0 and C = 1, what comes out of the second gate?

    0.

    First gate: 1 and 0 differ, so P = 1. Second gate: P = 1 and C = 1 match, so the output is 0. The slip to avoid is forgetting to feed P on.

The big picture

A logic gate is an electronic component that carries out a logical operation on inputs and outputs that are True or False, written 1 (high voltage) or 0 (low voltage). XOR, short for exclusive OR, has two inputs and one output: it outputs 1 when exactly one input is 1 and 0 when the inputs are the same. It differs from OR only when both inputs are 1, where OR gives 1 and XOR gives 0. Its symbol is the OR symbol with an extra curved line across the input side, it is written A XOR B or A ⊕ B, and its output can feed further gates.

Key points

1A logic gate is an electronic component that carries out a logical operation on inputs and outputs that are 1 (True) or 0 (False).
2XOR (exclusive OR) has two inputs and one output. It outputs 1 when the inputs differ and 0 when they are the same.
3XOR truth table: 0 0 gives 0; 0 1 gives 1; 1 0 gives 1; 1 1 gives 0.
4XOR differs from OR only in the 1 1 row: OR gives 1, XOR gives 0.
5Symbol: the OR symbol plus an extra curved line across the input side. Written A XOR B or A ⊕ B. In a circuit, XOR's output column can be the input to the next gate.

Worked example

Problem

Q = A XOR B. You're told Q = 1 and A = 1. What is B? Then: what would B be if you'd been told Q = 0 and A = 1 instead?

⚠ Watch out

Treating XOR as if it were OR and writing a 1 in the A = 1, B = 1 row. Both inputs are the same there, so XOR outputs 0.

🧠

Memory hook

XOR asks one question: 'Are you two different?' Different means 1. Matching means 0, even when both are 1.

✓

Check yourself

Cover the page. Write XOR's four-row truth table from memory. Then circle the one row where an OR gate would give a different output, and say what OR gives there.

Flashcards

(10)
What is a logic gate?
An electronic component that carries out a logical operation. Each gate has its own symbol and its own truth table.
In logic, what do 1 and 0 stand for?
1 is True (high voltage). 0 is False (low voltage).
What does XOR stand for?
Exclusive OR.
How many inputs and outputs does an XOR gate have?
Two inputs and one output.
When does an XOR gate output 1?
When exactly one input is 1, so the two inputs are different.
What does XOR output when both inputs are 0?
0. The inputs are the same.
Which input pair do OR and XOR give different outputs for?
A = 1, B = 1. OR gives 1; XOR gives 0.
How does the XOR symbol differ from the OR symbol?
It has an extra curved line across the input side.
Give two common ways to write XOR in a Boolean expression.
A XOR B and A ⊕ B.
XOR's output feeds another gate. What do you work out first in the truth table?
The XOR output column, for every input row. Then use it as the input to the next gate.

Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.

Learning with Lightbulb is opening soon

You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.

Keep me posted

More AQA GCSE Computer Science topics

See the full AQA Computer Science curriculum →

How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 4 November 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.