The Core XOR Truth Table and Schematic Symbols
When reading an XOR schematic, you will typically encounter one of two symbols: the traditional IEEE/ANSI shape (a curved D-shape with an extra input arc) or the IEC rectangular symbol (a rectangle with an '=1' inside). The Boolean expression is written as \( Y = A \oplus B \) (A XOR B), or algebraically as \( Y = A\overline{B} + \overline{A}B \).Standard 2-Input XOR Truth Table
| Input A | Input B | Output Y | Logic State Description |
|---|---|---|---|
| 0 (LOW) | 0 (LOW) | 0 (LOW) | Inputs match; no state change |
| 0 (LOW) | 1 (HIGH) | 1 (HIGH) | Inputs differ; state change detected |
| 1 (HIGH) | 0 (LOW) | 1 (HIGH) | Inputs differ; state change detected |
| 1 (HIGH) | 1 (HIGH) | 0 (LOW) | Inputs match; no state change |
Common XOR IC Families Compared
Choosing the right IC for your schematic depends on your voltage rail, speed requirements, and power budget. Here is how the three most common quad 2-input XOR ICs compare at room temperature (25°C):
| Parameter | 74HC86 (CMOS) | CD4030B (4000 Series) | 74LS86 (TTL) |
|---|---|---|---|
| Supply Voltage (\(V_{CC}\)) | 2.0V to 6.0V | 3.0V to 15.0V | 4.75V to 5.25V |
| Typ. Propagation Delay (\(t_{pd}\)) | 14 ns (at 5V) | 120 ns (at 5V) | 10 ns (at 5V) |
| Max DC Output Current (\(I_{OH}\)/\(I_{OL}\)) | ±2.5 mA (at 4.5V) | ±6.8 mA (at 10V) | -0.4 mA / +8 mA |
| Quiescent Power Dissipation | ~1 µW (static) | ~2.5 µW (static) | ~50 mW (static) |
| Input Structure | Standard CMOS | Standard CMOS | Bipolar (Pull-up) |
Source: Refer to the TI SN74HC86 Product Page and standard 4000-series datasheets for full parametric curves.
Worked Example: 74HC86 Propagation Delay and Fan-Out
Let's look at a real-world numeric scenario. Suppose you are building a 4-bit even parity generator for a custom memory bus using a 74HC86 IC powered at \(V_{CC} = 5V\). You need to cascade three XOR gates to compare four data bits (D0, D1, D2, D3).Step 1: Calculate Maximum Propagation Delay
The signal must pass through three gates sequentially: \( ((D0 \oplus D1) \oplus D2) \oplus D3 \).
According to the datasheet, the maximum propagation delay (\(t_{pd}\)) for a 74HC86 at 5V and 25°C is 25 ns per gate.
Total worst-case delay = \( 3 \times 25\text{ ns} = 75\text{ ns} \).
If your memory controller requires a 20 ns setup time before the clock edge, your parity signal must settle in \( 100\text{ ns} \). Since \( 75\text{ ns} < 100\text{ ns} \), the 74HC86 is fast enough for a 10 MHz bus, but would fail on a 20 MHz bus where the total period is only 50 ns.
Step 2: Calculate DC Fan-Out
You want to drive multiple status LEDs and microcontroller inputs from the final XOR output.
The 74HC86 can source a maximum of \( I_{OH} = -2.5\text{ mA} \) (at 4.5V).
The input leakage current (\(I_{IH}\)) of another 74HC gate is just \( 1\text{ \mu A} \).
Theoretical DC Fan-out = \( 2500\text{ \mu A} / 1\text{ \mu A} = 2500 \) gates.
The Catch (Capacitive Loading): In high-speed digital design, DC fan-out is irrelevant. Every CMOS input adds about 5 pF of capacitance. The 74HC86 is rated to drive a maximum load capacitance (\(C_L\)) of 50 pF without severely degrading rise/fall times. Therefore, your practical AC fan-out is limited to roughly 10 standard CMOS inputs before you need to add a buffer (like a 74HC244) to maintain that 25 ns propagation delay.
Where You Meet XOR Logic in Practice
You don't just find XOR schematics on PCBs; they are embedded in physical infrastructure and everyday electromechanical systems.1. Home Wiring: The 3-Way Switch
The most common physical manifestation of an XOR gate is the 3-way light switch setup used in staircases and hallways. Two single-pole, double-throw (SPDT) switches are wired with a 'traveler' configuration. The light turns ON if Switch 1 is UP and Switch 2 is DOWN, or if Switch 1 is DOWN and Switch 2 is UP. If both are in the same position, the light is OFF. This is a perfect, mechanical XOR truth table.
2. Quadrature Encoders for Motor Control
In robotics and CNC machines, rotary encoders output two square waves (Channel A and Channel B) that are 90 degrees out of phase. To detect movement and multiply the resolution (4x encoding), microcontrollers or FPGAs feed these signals into XOR gates. The XOR output goes HIGH only during the specific edge transitions where the channels differ, allowing the system to generate precise step pulses for closed-loop PID motor control.
3. Parity Generators and ECC Memory
Error-Correcting Code (ECC) RAM uses banks of XOR gates to generate parity bits. When data is written, a tree of XOR gates calculates whether the number of '1's in the byte is even or odd. When the data is read, the XOR tree recalculates the parity and compares it to the stored parity bit. A mismatch immediately flags a single-bit flip caused by cosmic rays or electromagnetic interference.
Common Schematic Mistakes and Troubleshooting
When prototyping XOR circuits on a breadboard or designing a custom PCB, a few recurring errors lead to frustrating debugging sessions.- Floating CMOS Inputs: If you leave an unused input on a 74HC86 unconnected, it acts as an antenna. It will pick up ambient 50/60 Hz mains noise, causing the internal MOSFETs to rapidly switch between ON and OFF. This results in massive current draw, overheating the IC, and injecting noise into your power rail. Fix: Always tie unused inputs to GND or \(V_{CC}\) via a 10k\(\Omega\) resistor.
- Slow Rise Times on Long Wires: Standard XOR gates lack internal Schmitt triggers. If you feed an XOR gate a slow-rising analog signal (like a sine wave from a sensor or a long, capacitively-loaded cable), the gate will oscillate violently as the voltage crosses the logic threshold multiple times. Fix: Condition the signal with a Schmitt-trigger inverter (like a 74HC14) before it hits the XOR gate, or use an RC network to sharpen the edge.
- Confusing XOR with XNOR in Active-Low Circuits: If your microcontroller's interrupt pin is configured for active-LOW, and you want to trigger an interrupt when two signals mismatch, an XOR gate will output HIGH on a mismatch (doing nothing to the active-LOW pin). You actually need an XNOR gate (like a 74HC266) to pull the line LOW when a mismatch occurs.
Frequently Asked Questions
Can I build an XOR gate using only NAND gates?
Yes. An XOR gate can be constructed using exactly four 2-input NAND gates (using an IC like the 74HC00). This is a common exercise in discrete logic design and is frequently used in FPGA fabric where NAND/NOR primitives are more abundant than dedicated XOR macrocells.
Why does my XOR output oscillate when I use mechanical switches?
Mechanical switches suffer from contact bounce, creating a flurry of rapid HIGH/LOW transitions lasting 5 to 50 milliseconds. Because the XOR gate reacts in nanoseconds, it will pass every single bounce to the output. Use an SR latch (built from NAND or NOR gates) or a dedicated debounce IC like the MAX6816 to clean the signal before it reaches your XOR logic.
Is there a difference between an XOR gate and a digital comparator?
Yes. A 2-input XOR gate is effectively a 1-bit magnitude comparator that tells you if the bits are different. A full digital comparator (like the 74HC85) uses a network of XOR, AND, and OR gates to compare multi-bit binary numbers and outputs specific 'Greater Than', 'Less Than', or 'Equal' flags.
For deeper reading on logic family characteristics and threshold voltages, consult the Electronics Tutorials XOR Gate Guide or your specific IC manufacturer's logic design manual.






