XOR Gate – Logic Gates Tutorial

The XOR gate is a logic gate where the output goes HIGH (or “1”) if one – and only one – of its inputs are HIGH. XOR stands for Exclusive-OR. Check out its symbol and truth table below.

XOR gate truth table and symbol

The logic or Boolean expression for an XOR gate is A \oplus B = Q which means that:

If A and B are different from each other, then Q is true

Truth Table

XOR gates are usually found with just two inputs. If either of the two inputs is 1, while the other is 0, then the output becomes 1.

Said in a different way, the output is HIGH only when its two inputs are not the same.

XOR Gate Truth Table

XOR gate symbol
Input A Input B Output Q
0 0 0
0 1 1
1 0 1
1 1 0

IC Alternatives with XOR Gates

CD4070 Pinout

If you want to experiment and build circuits with XOR gates, you’ll find them in both the 4000 IC series and the 7400 IC series:

  • 4030: Four XOR gates
  • 4070: Four XOR gates
  • 74HC86: Four XOR gates (HC is the family, can also be LS/HCT/…)

These should all be available as hobbyist-friendly through-hole chips. Just make sure you buy the DIP package version.

XOR Gate Example Circuit: Toggle Flip flop

You can use the XOR for lots of things. Below is an example circuit with an XOR and a D flip flop to create a Toggle flip flop.

Instead of setting the flip flop to 1 or 0, which is what you’d normally do with a d flip flop, you’ll toggle the flip flop whenever the input is HIGH. So if Q was HIGH, it will be LOW. If it was LOW, it will be HIGH.

Toggle flip flop circuit

Next Step in the Logic Gates Tutorial

Check out the other articles in this logic gates tutorial:

NOT Gate/Inverter
AND Gate
NAND Gate
OR Gate
NOR Gate
XOR Gate – (You are here)
XNOR Gate

Back to the Logic Gates Overview

Source