AI worksheet builder and 715 free math exercise generators — no subscription or registration required. Optional tips help keep them free. Tip →

Article

Bitwise XOR

Go to Math Operation

Bitwise XOR: how to solve

Bitwise XOR compares two binary numbers bit by bit. For each position, the result is:

  • 0 XOR 0 = 0
  • 1 XOR 1 = 0
  • 0 XOR 1 = 1
  • 1 XOR 0 = 1

So XOR gives 1 when the two bits are different, and 0 when they are the same.

Method

  1. Write the numbers in binary and line up the bits from right to left.
  2. Compare each column separately using the rules above.
  3. Write the result bit by bit.
  4. If the answer is expected in decimal or simplified form, convert the binary result back if needed.

Example strategy

If one bit pair is 1 and 0, the result is 1. If the pair is 1 and 1, the result is 0. Keep going across all positions until every bit has been processed.

Check your work

A good check is to verify each bit position independently. The final answer should have 1s exactly where the input bits differ, and 0s where they match. If you convert back to another number system, make sure the value matches the binary result exactly.

© 2023-2026 AI MATH COACH