Overview
An XNOR gate is a digital logic gate that yields a true (1) output exactly when its inputs are equal. For two inputs A and B the XNOR returns 1 when both are 0 or both are 1, and returns 0 when the inputs differ. It is commonly described as the negation of XOR (exclusive OR) and is also called the equivalence or biconditional operator in Boolean algebra.
Logic, expressions and truth table
The XNOR function can be written in several equivalent forms. Common Boolean expressions are:
- A XNOR B = NOT(A XOR B)
- A XNOR B = (A AND B) OR (NOT A AND NOT B)
- A=0, B=0 → Output = 1
- A=0, B=1 → Output = 0
- A=1, B=0 → Output = 0
- A=1, B=1 → Output = 1
Symbols and variants
Graphically, the XNOR gate symbol is often shown as an XOR shape with a small inversion bubble at the output. Some texts denote it A ≡ B or A ↔ B, emphasizing its role as an equality test. For more than two inputs the generalized XNOR is typically defined as the complement of the multi-input XOR: it outputs 1 when an even number of inputs are 1 (including zero).
Implementation
In hardware the XNOR function can be built directly or realized by combining basic gates: an XOR followed by an inverter, or by implementing the sum of products (A AND B) OR (NOT A AND NOT B). In transistor-level designs and CMOS libraries there are optimized XNOR cells that balance area, speed and power for use in arithmetic circuits and comparators.
Uses and importance
Because it detects equality, the XNOR gate is widely used in digital comparators, equality detectors, bitwise equality checks, parity circuits and in specific stages of adders and arithmetic logic units. It also appears in error-checking schemes and simple control logic where matching conditions must be asserted. In Boolean logic and formal reasoning it corresponds to the biconditional connective, stating that two propositions are equivalent.
Notable facts and distinctions
- XNOR is not a universal gate by itself (unlike NAND or NOR) but is functionally useful when combined with other primitives.
- It is the logical complement of XOR; many implementations exploit this by inverting an XOR output.
- Care is needed with multi-input definitions: designers often rely on the parity interpretation (even number of ones → output 1).
Together these properties make the XNOR gate an important and intuitive building block of digital logic, particularly when equality or equivalence must be detected quickly and compactly in hardware designs.