Skip to content
BetterDL

XOR identities

Also called: XOR properties, XOR rules, exclusive-OR identities, XOR laws

The rules for simplifying XOR: A ⊕ 0 = A, A ⊕ 1 = A', A ⊕ A = 0 and A ⊕ A' = 1, plus the commutative and associative laws and self-cancelling.

XOR follows its own small set of rules. Four with a constant or a repeated input are worth memorizing:

  • = A. XOR with 0 passes A through.
  • = . XOR with 1 inverts A.
  • = 0. A signal never differs from itself.
  • = 1. A signal always differs from its complement.

The first two make XOR a controlled inverter: one input decides whether the other passes straight through or is flipped. Processors use a row of XORs sharing one control line to invert a whole number at once, which is a step in subtraction.

XOR is also commutative and associative, so you can reorder and regroup freely: means the same however you bracket it.

Put those together and you get self-cancelling: XORing the same value twice undoes it, = A. That is why XOR is used for simple masking and toggling.

Rules involving inversion:

  • = = . Inverting either input, or the output, gives XNOR.
  • = . Inverting both inputs changes nothing.
ABY

Worked examples

Example

B as a control input

In the waveform above, Y = , and B acts as the control.

  1. 1.

    Slots 1 to 4: B = 0, so Y = = A. Y copies A: 0 1 1 0.

  2. 2.

    Slots 5 to 8: B = 1, so Y = = . Y is A flipped: A is 0 1 1 0, so Y is 1 0 0 1.

Example

Simplifying with the identities

Simplify .

  1. 1.

    Reorder (commutative): .

  2. 2.

    = 0, so this is .

  3. 3.

    = B, leaving .

  4. 4.

    = . Check A = 1, B = 0: 1 ⊕ 0 ⊕ 1 ⊕ 1 = 1, and = 1. ✓

Common mistakes

  • Writing = A by analogy with = A. XOR of equal values is 0.

  • Writing = 1 by analogy with OR. XOR with 1 inverts.

  • Thinking is XNOR. Two inversions cancel, so it equals .

Practice XOR identities

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

XOR identities is taught in Logic Gates and Boolean Algebra.