Skip to content
BetterDL

XNOR gate

Also called: exclusive NOR, exclusive-NOR gate, equivalence gate, ENOR gate, EXNOR gate, XNOR logic gate

A logic gate whose output is 1 when its two inputs are equal and 0 when they differ. It is an XOR with an inverted output, also called the equivalence gate.

An XNOR gate is an XOR with a bubble on its output. For two inputs, Y = , which also equals . Its output is 1 when the inputs are equal, both 0 or both 1, so it is also called the equivalence gate.

Truth table, rows 00 to 11: 1 0 0 1. That is XOR's column with every bit flipped.

XNOR is the hardware equality test. To check whether two binary numbers are the same, compare each pair of bits with an XNOR, then AND all the XNOR outputs. The result is 1 only if every pair matched. Equality comparators work exactly this way.

Some handy facts:

  • Inverting either input of an XOR gives an XNOR: = .
  • With one input held at 1, XNOR passes the other through: = A. With it held at 0, XNOR inverts.
  • Both inputs tied to the same signal always give 1.

With three or more inputs, an XNOR gate (a multi-input XOR plus one output bubble) is 1 when an even number of inputs are 1. That is the even function.

ABY

Worked example

Example

Checking two 2-bit numbers for equality

Compare X = X1X0 with Z = Z1Z0 using two XNORs and an AND: E = .

X1Z1X0Z0E
  1. 1.

    X = 10, Z = 10. High bits 1 and 1 match, so the first XNOR gives 1. Low bits 0 and 0 match, so the second gives 1.

  2. 2.

    AND: 1 · 1 = 1. E = 1, the numbers are equal.

  3. 3.

    Now X = 10, Z = 11. High bits match (1), low bits 0 and 1 differ (0).

  4. 4.

    AND: 1 · 0 = 0. E = 0, the numbers differ.

Common mistakes

  • Saying a 3-input XNOR is 1 when all three inputs are equal. It is 1 for an even number of 1s, so 111 gives 0 and 011 gives 1.

  • Building a 3-input XNOR from two chained 2-input XNORs. The chain gives , the odd function, not the even one.

  • Writing XNOR as . Inverting both inputs changes nothing: = .

Practice XNOR gate

Interactive questions with instant feedback and a worked solution for every wrong answer.

Boolean Simplification lesson full course

Learn it step by step

XNOR gate is taught in Logic Gates.