Skip to content
digiwleeaTools
LearnGlossaryAboutCheat sheetHow a CPU worksBuild a CPUToolsOpen the lab →

XNOR gate using NOR gates: four gates, live

An XNOR gate takes four NOR gates: N1 = NOR(A, B), N2 = NOR(A, N1), N3 = NOR(B, N1), and Y = NOR(N2, N3) is 1 exactly when A and B are equal. It is the NOR mirror of the four-NAND XOR, and the live circuit below lets you try all four input rows.

The trick is the shared first gate. N1 = NOR(A, B) is 1 only when both inputs are 0. Feeding it back with each input picks out one of the two rows where the inputs differ: N2 = NOR(A, N1) works out to NOT A AND B, and N3 = NOR(B, N1) to A AND NOT B. The last NOR outputs 1 only when neither of those is true, that is when A and B are the same, which is XNOR. So with NOR gates XNOR is the cheap gate (four) and XOR from NOR gates needs a fifth NOR as an inverter, the opposite of NAND logic, where XOR takes four NANDs and XNOR takes five. XNOR is the equality detector inside every comparator: two bits are equal exactly when their XNOR is 1.

Live circuit: click the inputs to toggle them and watch the outputs update. It runs the real simulator, right here on the page.

Open this circuit in the lab →

Embed or cite this circuit

Free to embed on a course page, blog or worksheet: paste this code. The circuit stays live, and the small digiwleea badge links back here.

To cite it: digiwleea, “XNOR gate from NOR gates”, https://digiwleea.wleeaf.dev/tools/build/xnor-from-nor/

What you need

Step by step

  1. Place inputs A and B and a probe Y.
  2. N1 = NOR(A, B): it is 1 only for A = B = 0.
  3. N2 = NOR(A, N1) and N3 = NOR(B, N1): each is 1 on one of the rows where A and B differ.
  4. NOR N2 with N3 into Y: Y is 1 when neither difference row is active, so when A equals B.
  5. Try all four rows: Y is 1 for 00 and 11 and 0 for 01 and 10.

XNOR from NOR truth table

ABN1N2N3Y
001001
010100
100010
110001

N2 and N3 are never 1 together, and each marks one of the two rows where the inputs differ. All four rows are checked on the live circuit before the page is built.

You can also read the full theory in the lesson on NOR as a universal gate. Prefer to build it yourself from scratch? Open the digiwleea lab and place the gates on the canvas, or start from the logic gate simulator.

More builds: Universal gates: NAND only, NOR only

All 246 build guides, by topic

Each of these is one step from a transistor to a working CPU. Build every gate from CMOS transistors and work all the way up in the free digiwleea lab, with the free theory reference alongside.

Open the XNOR gate from NOR gates in the lab →

Frequently asked

How many NOR gates are needed to make an XNOR gate?

Four. N1 = NOR(A, B), N2 = NOR(A, N1), N3 = NOR(B, N1), and Y = NOR(N2, N3) is A XNOR B.

Why does XNOR take fewer NOR gates than XOR?

The four-gate NOR network naturally computes XNOR, so XOR needs a fifth NOR as an inverter. With NAND gates it is the other way round: four NANDs give XOR and a fifth makes XNOR.

What is the Boolean expression of XNOR?

Y = A B + A' B', which is 1 when both inputs are 1 or both are 0. It is the complement of XOR: Y = (A XOR B)'.

Can you build XNOR from NAND gates?

Yes, with five: four NANDs make XOR and a fifth NAND with both inputs tied together inverts it into XNOR.