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.

The logic or Boolean expression for an XOR gate is 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.

IC Alternatives with XOR Gates

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 gate, and a D flip-flop to create a T 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.