What Is an XOR Calculator?
An XOR calculator computes the bitwise exclusive OR of two numbers. XOR compares the binary digits of two values and returns 1 wherever the bits differ and 0 wherever they match. It is a fundamental operation in computer science, cryptography, error detection, and digital logic. Enter two numbers in decimal, binary, or hexadecimal, and the calculator returns the XOR result in each base.
How to Use the XOR Calculator
- Enter the first number.
- Enter the second number.
- Choose the base — decimal, binary, or hexadecimal.
- Calculate — see the XOR result with its binary representation.
The XOR Truth Table
| Bit A | Bit B | A XOR B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
The result is 1 only when the two bits are different. For example, 5 XOR 3 = 6, because 101 XOR 011 = 110.
Key Properties of XOR
- Self-inverse: A XOR A = 0, and A XOR 0 = A.
- Reversible: if C = A XOR B, then C XOR B = A — the basis of simple encryption.
- Commutative and associative: order and grouping do not change the result.
Where XOR Is Used
- Cryptography: XOR ciphers and key mixing.
- Error detection: parity bits and checksums.
- Graphics: toggling pixels and simple masking.
- Algorithms: swapping values and finding a unique element.
Frequently Asked Questions
What does XOR mean?
XOR stands for exclusive OR. It compares two bits and returns 1 if they differ and 0 if they are the same.
How do you calculate XOR of two numbers?
Convert both numbers to binary, compare each pair of bits, and output 1 where they differ. For example, 5 XOR 3 = 6 because 101 XOR 011 = 110.
Why is XOR used in encryption?
XOR is reversible: applying the same key twice returns the original data. This makes it the core of simple stream ciphers and key-mixing operations.
What is A XOR A?
Any value XORed with itself is 0, because every bit matches its own value. Likewise, A XOR 0 leaves A unchanged.
Is this XOR calculator free?
Yes — it is completely free, requires no signup, and works in decimal, binary, and hex.