The XOR (= "exclusive or") logic gate takes two bits as an input. Its output follows the rule: "if both bits are different, output $1$; if they are the same, output $0$." This gate acts exactly as the bitwise "xor" operator in programming does: given the Boolean variables $x$ and $y$, the symbol: $x ^\wedge y$ (
$x ^\wedge y$) or $x \oplus y$ ($x \oplus y$) means "$x$ xor $y$".
Below is the XOR gate diagram and truth table.
XOR Gate diagram. Miriam Briskman, CC BY-NC 4.0.
| Input | Output | |
|---|---|---|
| $x$ | $y$ | $x \oplus y$ |
| $0$ | $0$ | $0$ |
| $0$ | $1$ | $1$ |
| $1$ | $0$ | $1$ |
| $1$ | $1$ | $0$ |