Computer Science
Intermediate

XOR Operation

Exclusive OR: true when exactly one input is true.

Formula

ab=(ab)¬(ab)a \oplus b = (a \lor b) \land \lnot(a \land b)

Variables

a, bBoolean bits

Example

1 ⊕ 1 = 0

Did You Know?

XOR is reversible — apply it twice with the same key and you get the original back, the basis of simple ciphers.