XOR Gate Simulator
Use the free XOR Gate Simulator to test Exclusive OR logic instantly. Switch Input A and Input B between 0 and 1 and watch the result update immediately. A two-input XOR gate produces output 1 when the two inputs are different and output 0 when they are the same.
What Is an XOR Gate?
An XOR gate, short for Exclusive OR, is a digital logic gate that compares binary inputs and produces output 1 when the inputs are different. For a standard two-input XOR gate, exactly one input must be HIGH for the output to be HIGH.
If both inputs are 0 or both inputs are 1, the output is 0. This difference- detecting behavior makes XOR useful in binary addition, parity generation, comparison, toggling, and many digital logic applications.
XOR Gate Truth Table
A two-input XOR gate has four possible input combinations.
| Input A | Input B | XOR Output |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
How to Use the XOR Gate Simulator
Choose binary 0 or binary 1 for the first input.
Choose 0 or 1 for the second digital input.
XOR checks whether the two input states are different.
Different inputs produce 1. Matching inputs produce 0.
Use the quick buttons to verify every row in the XOR truth table.
XOR Gate Input and Output Examples
0 XOR 0
Both inputs match, so the XOR output is 0.
0 XOR 1
The inputs are different, so the output becomes 1.
1 XOR 0
The inputs are different, so the XOR output is 1.
1 XOR 1
Both inputs match, so the output returns to 0.
Why Does 0 XOR 1 Equal 1?
Exclusive OR is true when exactly one of the two inputs is true. With inputs 0 and 1, one input is LOW and the other is HIGH.
B = 1
A XOR B = 1
The same reasoning applies to 1 XOR 0.
Why Does 1 XOR 1 Equal 0?
The word exclusive is important. XOR does not accept the case where both inputs are simultaneously true.
Standard OR, by comparison, gives 1 OR 1 = 1.
XOR Boolean Expression
A two-input XOR gate can also be constructed from AND, OR, and NOT operations.
This expression says the result is true when A is true and B is false, or when A is false and B is true.
XOR Gate vs OR Gate
OR and XOR are identical for three of the four two-input combinations. Their difference appears when both inputs are 1.
| A | B | OR | XOR |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 0 |
XOR Gate vs XNOR Gate
XNOR is the exact inverse of XOR. XOR detects difference, while XNOR detects equality.
| A | B | XOR | XNOR |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
XOR Gate and Binary Addition
XOR is especially important in binary arithmetic because it produces the sum bit of a basic half-adder.
| A | B | Sum (XOR) | Carry (AND) |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
When 1 + 1 is performed in binary, the sum position becomes 0 and a carry of 1 is generated. XOR provides the sum bit while AND provides the carry.
XOR as a Difference Detector
Because XOR outputs 1 whenever its two inputs differ, it can act as a simple one-bit comparator for inequality.
A ≠ B → XOR = 1
XNOR performs the complementary equality check.
XOR and Parity
XOR is commonly used to calculate parity because repeated XOR operations indicate whether an odd or even number of input bits are 1.
There are two 1 bits in the example, so the XOR result is 0. With an odd number of 1 bits, repeated XOR produces 1.
XOR and Bit Toggling
In programming, bitwise XOR can toggle selected bits using a mask. A mask bit of 1 flips the corresponding data bit, while a mask bit of 0 leaves that position unchanged.
Useful XOR Properties
| Property | Rule |
|---|---|
| Identity | A XOR 0 = A |
| Toggle | A XOR 1 = NOT A |
| Self-cancel | A XOR A = 0 |
| Commutative | A XOR B = B XOR A |
| Associative | (A XOR B) XOR C = A XOR(B XOR C) |
Why Does A XOR A Equal 0?
XOR outputs 1 only when the two inputs differ. If the same value is compared with itself, the two states always match.
1 XOR 1 = 0 Therefore: A XOR A = 0
Why Does A XOR 1 Invert A?
When one XOR input is permanently set to 1, the output is always the opposite of the other input.
1 XOR 1 = 0 Therefore: A XOR 1 = NOT A
This is why XOR is useful for selectively toggling binary bits.
XOR Gate vs Binary XOR
XOR Gate
Usually refers to a digital circuit that evaluates individual binary signals.
Binary XOR
Applies the same XOR rule independently across corresponding positions of multi-bit binary values.
Three-Input XOR Gate
When XOR is extended across more than two inputs, repeated XOR produces 1 when an odd number of the inputs are 1.
1 XOR 1 XOR 0 = 0
1 XOR 1 XOR 1 = 1
This odd-parity behavior is useful in arithmetic and error-detection circuits.
How an XOR Gate Works in Digital Electronics
An XOR circuit evaluates whether its binary input states differ. The physical implementation may be built from combinations of simpler transistor or logic structures, but its external Boolean behavior follows the same XOR truth table.
LOW and HIGH represent logical signal states associated with binary 0 and 1. Actual voltage thresholds depend on the logic family and circuit design.
Where Are XOR Gates Used?
Half Adders
Generate the sum bit when adding two individual binary digits.
Full Adders
Multiple XOR operations help combine operand bits with a carry-in signal.
Parity Generation
Detect whether an odd or even number of selected input bits are 1.
Digital Comparison
Produce a difference signal when two individual bits do not match.
Bit Toggling
XOR masks can flip selected binary positions without changing the others.
Data Processing
XOR appears in checksums, coding methods, reversible transformations, and many low-level algorithms.
Common XOR Gate Mistakes
They differ for input 1,1. OR gives 1, while XOR gives 0.
That is AND behavior. XOR is true when the inputs differ.
Exclusive OR excludes the both-true case in a standard two-input gate.
XOR detects difference. XNOR detects equality.
Repeated multi-input XOR gives 1 when an odd number of input bits are 1.
Related BinaryCon Tools
XOR Gate Simulator FAQs
What is an XOR gate?
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 both inputs are the same.
When does an XOR gate output 1?
What does XOR stand for?
What is the XOR symbol?
⊕, so XOR may be written as
A ⊕ B.
What is the difference between XOR and OR?
What is the difference between XOR and XNOR?
Why is XOR used in binary addition?
Why is XOR used for parity?
What is A XOR A?
A XOR A = 0 because a value always matches itself.
What is A XOR 0?
A XOR 0 = A. XOR with zero leaves the bit unchanged.
What is A XOR 1?
A XOR 1 = NOT A. XOR with 1 flips a single binary bit.
Can XOR have more than two inputs?
Is XOR used in programming?
Does this XOR Gate Simulator require registration?
Test XOR Gate Logic Instantly
Switch both inputs between 0 and 1, see the Exclusive OR output immediately, study the XOR truth table, and understand its role in binary addition, parity, comparison, bit toggling, and digital electronics.