BITXOR Function
Returns the bits that differ between two numbers (bitwise exclusive OR).
Category
Engineering
Available in
Excel 2013+, Microsoft 365
Returns
A whole number
Overview
BITXOR compares two numbers in binary and returns a 1 where exactly one of them has a 1 — where they differ.
Use it to flip a flag (on becomes off, off becomes on) or to see which switches changed between two codes.
Syntax
Arguments
| Argument | Required? | What it does |
|---|---|---|
| number1 | Yes | The first whole number. |
| number2 | Yes | The second whole number. |
Examples
Example 1 — How the bits combine
Each row combines the two numbers bit by bit; the answer is shown as an ordinary decimal number.
| A | B | C | |
|---|---|---|---|
| 1 | Number 1 | Number 2 | XOR |
| 2 | 5 | 3 | 6 |
| 3 | 12 | 10 | 6 |
| 4 | 7 | 7 | 0 |
Example 2 — What changed?
Compare last month's access code with this month's. Any non-zero answer shows which switches moved.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Person | Before | After | Changed |
| 2 | Ana | 13 | 5 | 8 |
| 3 | Ben | 3 | 3 | 0 |
| 4 | Cy | 7 | 15 | 8 |
8 is the Admin switch: Ana lost it and Cy gained it.
Common mistakes
- #NUM! Both numbers must be whole numbers from 0 up to 2^48 − 1 (281,474,976,710,655). Negative numbers, decimals and bigger values return #NUM!.
Notes
- Permission flags are a classic use: give each option a power of two (View = 1, Edit = 2, Approve = 4, Admin = 8) and store a person's access as one number — 13 means View + Approve + Admin.
- Related functions: BITAND, BITOR, XOR.

Author
Kyle Stott
Certified Microsoft Excel Expert
Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.