How to use the XOR Gate Simulator tool
- Pick a bit for Input A from its list.
- Pick a bit for Input B from its list.
- Select Calculate to evaluate A XOR B.
- Read the output bit in the Result box. A 1 means the inputs differ.
- Select Copy to copy the bit, or Clear to reset both lists.
XOR gate truth table
XOR means exclusive OR: one input or the other, but not both. It matches ordinary OR in three rows and departs from it when both inputs are 1, where XOR gives 0.
The simulator opens with Input A at 1 and Input B at 0, a pair that differs, so the first result is 1.
A B A XOR B
0 0 0
0 1 1
1 0 1
1 1 0Four ways to read XOR
The same truth table supports several mental models, and each one explains a different use.
- Difference detector: the output is 1 when the inputs are not equal.
- Addition without carry: 1 + 1 is 10 in binary, and XOR keeps the low digit 0. Paired with an AND gate for the carry, it forms a half adder.
- Controlled inverter: with B at 0 the output follows A, and with B at 1 the output is NOT A.
- Parity: chaining XOR gates over many bits gives 1 when an odd number of them are 1.
How the XOR gate simulator computes the result
Each list provides a one-bit value. The tool applies a bitwise XOR and prints the resulting bit. In Boolean terms the function is (A AND NOT B) OR (NOT A AND B).
Most programming languages write XOR as a caret. Note that the caret is not exponentiation in C, Java, JavaScript or Python. To XOR complete binary words, use the Bitwise XOR Calculator, which works on each pair of digits in turn.
Why XOR matters in software and hardware
XOR undoes itself: applying the same value twice returns the original, because (A XOR B) XOR B equals A. Stream ciphers and the one-time pad rely on this to encrypt and decrypt with one operation. RAID parity uses it to rebuild a missing block from the surviving ones, and simple checksums XOR all bytes of a message together.
In hardware, XOR gates form adders, parity generators, comparators and the feedback taps of linear feedback shift registers used in CRC circuits. The 7486 chip holds four two-input XOR gates, and the function can be built from four NAND gates.
Frequently asked questions
When does an XOR gate output 1?
When exactly one of its two inputs is 1. The pairs 0, 1 and 1, 0 give 1. The pairs 0, 0 and 1, 1 give 0.
Why is it called exclusive OR?
Because it excludes the case where both inputs are true. Ordinary OR accepts one input, the other, or both. XOR accepts one or the other only.
What is A XOR A?
Always 0, since a value never differs from itself. Set both lists to the same bit to see it. Assembly programmers use this to clear a register by XOR-ing it with itself.
How do I XOR three bits with this simulator?
Calculate A XOR B, then enter the result as Input A and the third bit as Input B. XOR is associative and commutative, so any order gives the same answer: 1 if an odd number of the bits are 1.
Is XOR a universal gate?
No. Unlike NAND and NOR, XOR alone cannot build AND or OR, so it cannot express every logic function. It is still one of the most used gates because arithmetic, parity and comparison all depend on it.