XOR Calculator
Perform the bitwise XOR (exclusive OR) operation. Each output bit is 1 when the corresponding input bits are different.
Results
A XOR B (Decimal)
49
A (Binary)
111100
B (Binary)
1101
Result (Binary)
110001
How to Use This Calculator
Enter your input values
Fill in all required input fields for the XOR Calculator. Follow the units and input format printed next to each field. Where a unit selector is available, choose the units that match your data.
Review your inputs
Double-check that all values are correct and match the units or format shown for each field. Incorrect units are the most common source of calculation errors and can produce results that are off by factors of 2, 10, or more.
Read the results
The XOR Calculator computes the output in your browser and displays the results, with units clearly labeled, as soon as they are ready — no data sent to a server.
Explore parameter sensitivity
Try adjusting individual input values to see how the output changes. This is a quick and effective way to develop intuition about how different parameters influence the result and to identify which inputs have the largest effect.
When to Use This Calculator
- •Use the XOR Calculator when you need a quick mathematical result without writing out all the steps manually, saving time on repetitive calculations.
- •Use it to verify hand calculations on tests or assignments and catch arithmetic mistakes.
- •Use it when teaching or explaining mathematical concepts to others, demonstrating how changing inputs affects the result.
- •Use it to explore the behavior of mathematical functions across a range of inputs.
Related Calculators
AND Calculator
Perform the bitwise AND operation on two numbers. Each output bit is 1 only when both corresponding input bits are 1.
NOR Calculator
Perform the bitwise NOR (NOT OR) operation. Each output bit is 1 only when both corresponding input bits are 0.
OR Calculator
Perform the bitwise OR operation on two numbers. Each output bit is 1 when at least one corresponding input bit is 1.
Bit Shift Calculator
Perform left shift (<<) and right shift (>>) operations on binary numbers. Shift bits left to multiply by powers of 2, right to divide.
Bitwise Calculator
Perform bitwise AND, OR, XOR, NOT, NAND, NOR, and XNOR operations on binary numbers. Shows truth tables and binary results.
One's Complement Calculator
Calculate the one's complement (bitwise NOT) of a binary number. Invert all bits — 0s become 1s and 1s become 0s.
About XOR Calculator
XOR (exclusive OR) produces a 1 when the two input bits are different and a 0 when they are the same. XOR is one of the most versatile bitwise operations in computer science. It is its own inverse: A XOR B XOR B = A, which means XOR can be used for encryption/decryption (one-time pad cipher), error detection (parity bits), swapping variables without a temporary (a^=b; b^=a; a^=b), and detecting changes between two values. XOR is also the addition operation in GF(2) (binary Galois field), making it central to coding theory and CRC checksums. This calculator computes the bitwise XOR of two numbers.
The Math Behind It
Formula Reference
XOR Truth Table
0^0=0, 0^1=1, 1^0=1, 1^1=0
Variables: Output is 1 when inputs differ
Worked Examples
Example 1: 60 XOR 13
Compute bitwise XOR of 60 and 13.
60 XOR 13 = 49₁₀ = 110001₂
Common Mistakes & Tips
- !Confusing XOR with OR — XOR gives 0 when both inputs are 1, while OR gives 1.
- !Forgetting that XOR is its own inverse — applying it twice restores the original value.
Related Concepts
Used in These Calculators
Calculators that build on or apply the concepts from this page:
Frequently Asked Questions
How can XOR be used for encryption?
In a one-time pad, plaintext XOR key = ciphertext, and ciphertext XOR key = plaintext. If the key is truly random and as long as the message, this encryption is theoretically unbreakable.
How does the XOR swap trick work?
a ^= b sets a to a^b. Then b ^= a sets b to b^(a^b) = a. Then a ^= b sets a to (a^b)^a = b. The values are swapped without a temporary variable.
Add the live XOR Calculator to your site. Free to embed, with a link back to MegaCalc.