XOR Gate

Truth table for an XOR gate
Input AInput BOutput

An XOR gate (sometimes referred to by its extended name, Exclusive OR gate) is a digital logic gate with two or more inputs and one output that performs exclusive disjunction. The output of an XOR gate is true only when exactly one of its inputs is true. If both of an XOR gate's inputs are false, or if both of its inputs are true, then the output of the XOR gate is false.

If an XOR gate has more than two inputs, then its behavior depends on its implementation. In the vast majority of cases, an XOR gate will output true if an odd number of its inputs is true. However, it's important to note that this behavior differs from the strict definition of exclusive or, which insists that exactly one input must be true for the output to be true.

The truth table for an XOR gate with two inputs appears to the right.


Each of the symbols below can be used to represent an XOR gate. There are multiple international standards defined, and one may preferred over the other in your region of the world.

ANSI / IEEE XOR Gate symbol IEC XOR Gate symbol

Live Example

Try the following interactive example to see for yourself how an XOR gate behaves.

Further Reading

To learn more, check out the following external resources:

« Table of Contents