CMOS XNOR gate: twelve transistors, live
A static CMOS XNOR gate uses twelve transistors: two inverters make NOT A and NOT B, and an eight-transistor complex gate pulls the output low when A and B differ and high when they are equal, so Y is 1 exactly when A = B.
The pull-down network has two NMOS paths from Y to ground: A in series with NOT B, and NOT A in series with B. One of them conducts exactly when A and B differ, giving Y = 0. The pull-up network is its dual: PMOS on A and NOT B in parallel, in series with PMOS on NOT A and B in parallel, which conducts exactly when A = B. It is the CMOS XOR with NOT B and B swapped in both networks, so it costs the same twelve transistors, two fewer than an XOR followed by an inverter. Equality checks are where XNOR earns its keep: a 1-bit comparator's EQ output is an XNOR, and an n-bit equality test is n XNORs feeding an AND. Compare the gate-level truth table on the XNOR truth table page.
Open this circuit in the lab →
What you need
- 2× CMOS inverter (1 PMOS + 1 NMOS): NOT A and NOT B
- 4× NMOS transistor: pull-down: (A series NOT B) in parallel with (NOT A series B)
- 4× PMOS transistor: pull-up: (A parallel NOT B) in series with (NOT A parallel B)
Step by step
- Place a VDD rail, a GND rail, inputs
AandB, and a probeY; build two CMOS inverters for NOT A and NOT B. - Pull-down: NMOS A in series with NMOS NOT B from Y to GND, and in parallel NMOS NOT A in series with NMOS B. Either path conducts when A and B differ.
- Pull-up: PMOS A and PMOS NOT B in parallel from VDD to a middle node, then PMOS NOT A and PMOS B in parallel from that node to Y. It conducts when A and B are equal.
- Step through the four rows: Y is 1 for 00 and 11, and 0 for 01 and 10.
CMOS XNOR truth table
| A | B | Pull-down on | Pull-up on | Y |
|---|---|---|---|---|
| 0 | 0 | no | yes | 1 |
| 0 | 1 | yes | no | 0 |
| 1 | 0 | yes | no | 0 |
| 1 | 1 | no | yes | 1 |
All four rows of the live circuit are checked before the page is built. In every row exactly one of the two networks conducts, so Y is always driven and VDD never connects to GND.
You can also read the full theory in the lesson on XOR at the transistor level. 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: Gates from transistors (CMOS)
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 CMOS XNOR gate in the lab →Frequently asked
How many transistors are in a CMOS XNOR gate?
Twelve in this static design: four for the two input inverters and eight for the complex gate. Transmission-gate and pass-transistor versions use fewer, at some cost in drive strength.
What is the difference between a CMOS XOR and XNOR?
They use the same structure; the XNOR swaps B and NOT B in both networks, so its output is high when the inputs are equal instead of when they differ.
Why is XNOR called an equality gate?
Because its output is 1 exactly when its two inputs are equal. Comparators use one XNOR per bit and AND the results to test whether two numbers are equal.