⚡ Free Bitwise Calculator

Binary XOR Calculator

Perform a bitwise XOR operation on two binary numbers instantly. BinaryCon returns 1 when corresponding bits are different and 0 when the two bits are the same.

✓ Free ✓ Instant Result ✓ Auto Alignment ✓ Long Binary Values
A⊕B
Binary XOR
Ready
0 and 1 only
XOR
0 and 1 only
Different lengths are automatically padded with leading zeros.
Try:
✓ XOR Result
Bitwise XOR result after aligning both binary values
Bit Width 0
Different Bits 0
Same Bits 0

What Is a Binary XOR Calculator?

A Binary XOR Calculator performs the exclusive OR operation on two binary numbers. It compares corresponding bits independently and outputs 1 when the bits differ.

If both bits are the same, whether both are 0 or both are 1, XOR returns 0. This makes XOR particularly useful for detecting differences between bit patterns.

1010
XOR 1100
—-
0110

Different bits → 1

The combinations 0 XOR 1 and 1 XOR 0 both produce a result of 1.

Matching bits → 0

The combinations 0 XOR 0 and 1 XOR 1 both produce a result of 0.

Binary XOR Truth Table

A B A XOR B
000
011
101
110
Core rule: XOR returns 1 when the two corresponding bits are different.

How to Calculate Binary XOR

Enter the first binary number

Use a value containing only 0s and 1s, such as 101101.

Enter the second binary number

Place the second value so its bit positions correspond with the first value.

Align the rightmost bits

If the values have different lengths, add leading zeros to the shorter one.

Compare each bit pair

Return 1 when the bits differ and 0 when the two bits are identical.

Combine the output

Read all result bits from left to right to obtain the final XOR value.

Worked Example: 101101 XOR 110011

Position A B XOR
1110
2011
3101
4101
5011
6110
Final result: 101101 XOR 110011 = 011110

Example: 1010 XOR 1100

1010
XOR 1100
—-
0110

The middle two positions differ, so they become 1. The first and last positions match, so they become 0.

Binary XOR with Different Bit Lengths

For unsigned binary numbers, the shorter value can be padded on the left with zeros before the XOR operation.

1011
0010
Then: 1011 XOR 0010 = 1001

XOR with Zero

XOR with an all-zero value leaves the original bit pattern unchanged.

101101 XOR 000000 = 101101

This follows directly from 0 XOR 0 = 0 and 1 XOR 0 = 1.

XOR a Value with Itself

Any binary value XOR itself produces zero because every corresponding pair of bits is identical.

101101 XOR 101101 = 000000

This identity is frequently used in low-level algorithms and programming.

XOR with All Ones

At a fixed bit width, XORing a value with all ones flips every bit.

101001 XOR 111111 = 010110

Each 0 becomes 1 and each 1 becomes 0 because every input bit is compared against 1.

Binary XOR and Decimal Values

1010₂ = 10₁₀
1100₂ = 12₁₀
XOR: 1010 XOR 1100 = 0110 Convert result: 0110₂ = 6₁₀ Therefore: 10 XOR 12 = 6

Why XOR Is Useful for Detecting Differences

XOR can highlight exactly which bit positions differ between two values. Every differing position becomes 1, while every matching position becomes 0.

Value A: 10110010 Value B: 10100110 XOR: 00010100

The 1 bits in the XOR result identify the positions where the two original values differ.

XOR and Bit Toggling

XOR masks are useful for toggling selected bits. A mask bit of 1 flips the corresponding bit, while a mask bit of 0 leaves it unchanged.

Original: 10110000 Toggle mask: 00001100 Result: 10111100

Important Properties of XOR

Property Formula Meaning
Commutative A XOR B = B XOR A Operand order does not matter.
Associative (A XOR B) XOR C = A XOR (B XOR C) Grouping does not change the result.
Identity A XOR 0 = A Zero leaves the original value unchanged.
Self-inverse A XOR A = 0 A value XOR itself becomes zero.
Reversible (A XOR B) XOR B = A Applying the same XOR mask twice restores the original value.

Binary XOR vs OR vs AND

A B AND OR XOR
00000
01011
10011
11110

XOR differs from OR specifically when both bits are 1. OR returns 1 in that case, while XOR returns 0.

XOR Is Exclusive OR

The word exclusive means the result is true when exactly one of the two one-bit inputs is 1.

OR

0 OR 1 = 1, 1 OR 0 = 1, and 1 OR 1 = 1.

XOR

0 XOR 1 = 1 and 1 XOR 0 = 1, but 1 XOR 1 = 0.

Where Is Binary XOR Used?

Bit Toggling

Masks can flip selected bits without changing the remaining positions.

Difference Detection

XOR highlights exactly which corresponding bits differ between two values.

Error Detection

Parity calculations and simple error-detection systems frequently use XOR.

Cryptography Concepts

XOR is a fundamental reversible operation used within many cryptographic constructions.

Digital Logic

XOR gates are used in adders, parity circuits, comparators, and other digital systems.

Programming

Developers use XOR for masks, flags, bit manipulation, checksums, and low-level algorithms.

XOR in Binary Addition

XOR plays an important role in binary addition. For two single bits without considering a carry-in, XOR produces the sum bit.

A B Sum Bit (XOR) Carry Bit (AND)
0000
0110
1010
1101

This combination of XOR and AND forms the basic logic of a half-adder circuit.

Common Binary XOR Mistakes

Confusing XOR with OR

Remember that 1 XOR 1 equals 0, while 1 OR 1 equals 1.

Using invalid binary digits

Binary values contain only digits 0 and 1.

Incorrectly aligning different lengths

Align values from the right and pad the shorter unsigned value with leading zeros.

Assuming XOR is irreversible

Applying the same XOR mask again restores the original value: (A XOR B) XOR B = A.

Related BinaryCon Tools

Binary XOR Calculator FAQs

What is binary XOR?
Binary XOR compares corresponding bits and returns 1 when they are different. Matching bits produce 0.
What is 0 XOR 0?
0 XOR 0 = 0.
What is 0 XOR 1?
0 XOR 1 = 1.
What is 1 XOR 0?
1 XOR 0 = 1.
What is 1 XOR 1?
1 XOR 1 = 0 because the two input bits are the same.
What is 1010 XOR 1100?
The result is 0110.
What is 101101 XOR 110011?
The six-bit result is 011110.
What happens when a value is XORed with zero?
The original value is preserved because each bit XOR 0 equals the original bit.
What happens when a value is XORed with itself?
The result is all zeros because every corresponding bit pair is identical.
Can XOR flip bits?
Yes. XOR with a mask bit of 1 flips the corresponding bit, while a mask bit of 0 leaves it unchanged.
Why is XOR useful for comparing binary values?
The result contains 1 at each position where the inputs differ and 0 where they match.
What is the difference between XOR and OR?
Both return 1 when exactly one input bit is 1, but for inputs 1 and 1, OR returns 1 while XOR returns 0.
Is XOR reversible?
Yes. If C = A XOR B, then C XOR B = A.
Can XOR use different-length binary values?
Yes. The shorter unsigned value can be padded with leading zeros before the operation.
Is XOR commutative?
Yes. A XOR B = B XOR A.
How is XOR used in binary addition?
For two input bits, XOR produces the sum bit while AND produces the carry bit. This is the basis of a half-adder circuit.
Can BinaryCon process long XOR values?
Yes. The calculator processes binary strings directly, allowing long bit patterns without ordinary floating-point conversion.

Calculate Binary XOR Instantly

Use BinaryCon’s free Binary XOR Calculator to compare bit patterns, detect differences, toggle bits, learn exclusive OR logic, and verify results instantly.

Scroll to Top