XOR detects difference, XNOR detects equality, and half-adders and parity checks lean on both. This page covers the tables, the identities and the pitfalls that bite in real wiring.
XOR outputs 1 when inputs differ: Y = A⊕B. XNOR is its complement, outputting 1 on equality. The identities do the daily work: A⊕0 = A (pass through), A⊕1 = Ā (controllable inverter), A⊕A = 0 (self-cancelling, used in checksums). Typical parts: 74HC86 (quad XOR) in CMOS, 74LS86 in TTL.
Three applications: half-adders (XOR for the sum bit, AND for carry - XOR underpins arithmetic), parity generation and checking (a tree of XORs over 8 bits flags an odd number of ones - the standard serial-link guard), and equality comparison (eight XNORs into an AND gate beats a subtract-compare by a mile). Practical notes: CMOS inputs must never float - tie every unused input high or low, or the output chatters; unequal input delays produce edge glitches, so sample the XOR output with a D flip-flop in synchronous designs; and driving 5V HC logic from 3.3V sits right at the VIH edge - use 74HCT parts for the interface. Verify a suspect chip against all four input states with switches and an LED in two minutes.
| A | B | XOR out | XNOR out |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
| A⊕0 = A | Unchanged by 0 | N/A | Buffer duty |
| A⊕1 = Ā | Inverted by 1 | N/A | Controlled inverter |
Motto: XNOR for equality, XOR for difference, an XOR tree for parity, one XOR for polarity control. Tie CMOS inputs, match trace delays, and let a flip-flop swallow the glitches.
The quantities and component characteristics discussed here follow current national standards and the corresponding IEC documents: Digital IC specification per GB/T 17574 (IEC 60748 series); logic symbols per GB/T 4728. Always check the device datasheet and the product design file for ratings and derating.
Locate the issue with the approach above, then confirm with measurements; safety-related circuits must follow the standards and manufacturer requirements.