gives the bitwise XOR of the integers ni.


  • Integer mathematical function, suitable for both symbolic and numerical manipulation.
  • BitXor[n1,n2,] yields the integer whose binary bit representation has ones at positions where an odd number of the binary bit representations of the ni have ones.
  • For negative integers BitXor assumes a two's complement representation.
  • BitXor automatically threads over lists.


open allclose all

Basic Examples  (1)

Scope  (3)

Use numbers of any size:

BitXor takes any number of arguments:

Use negative numbers:

Generalizations & Extensions  (1)

Basic symbolic simplifications are done automatically:

Applications  (4)

Make a nested pattern:

Generate a Gray code sequence [more info]:

Bitwise version of rule 60 cellular automaton:

Properties & Relations  (4)

Truth table for Xor:

BitXor is Orderless:

Even numbers of identical arguments give 0:

Neat Examples  (3)

"Munching squares" [more info]:

Introduced in 1999