Electronics & Circuits
Intermediate

XOR Gate

Output is 1 when inputs differ.

Formula

Y=A⊕BY = A \oplus B

Variables

A,BInputs

Example

1⊕1 = 0

How it works

An XOR gate compares two binary inputs and turns the output on only when the inputs are different. In digital logic, this is useful because it acts like a "mismatch detector": 0 and 1 produce 1, while 0 and 0 or 1 and 1 produce 0. The symbol \(\oplus\) is used because XOR is a standard logical operation in Boolean algebra and matches the idea of “exclusive or.”

When to use it

Use XOR when you need to detect inequality between two bits or toggle a state based on an input change. It appears in parity checking, adders in digital circuits, and simple control logic where only one of two signals should be active.

Worked example, step by step

Let A = 0 and B = 1 Y = A \oplus B Y = 0 \oplus 1 Y = 1 So, the output is 1 because the inputs are different.

Common mistakes to avoid

  • Treating XOR like ordinary OR, where any 1 input would give 1
  • Thinking XOR gives 1 when both inputs are 1
  • Forgetting that XOR depends on the inputs being different, not just on the presence of a 1

Did You Know?

The XOR gate outputs true only when inputs differ, making it the heart of binary addition and simple encryption.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026