Skip to content
digiwleeaTools
LearnGlossaryAboutCheat sheetHow a CPU worksToolsOpen the lab →

XOR gate using NOR gates: five gates, live

An XOR gate can be built from five NOR gates: four of them make XNOR, and the fifth, with both inputs tied together, inverts it into A XOR B. NOR gates naturally give XNOR, the mirror image of how four NAND gates give XOR.

The four-gate core is the dual of the XOR from four NAND gates: N1 = NOR(A, B), then N2 = NOR(A, N1) and N3 = NOR(B, N1), and NOR(N2, N3) is A XNOR B. Expanding shows why: N2 = NOT A AND B and N3 = A AND NOT B, the two cases where the inputs differ, so NORing them gives 1 exactly when A and B are equal. A fifth NOR used as an inverter turns that into XOR. So with NOR gates, XNOR costs four gates and XOR five, while with NAND gates it is the other way round. The same five gates, with N2 as the borrow, are the half subtractor from NOR gates; see also NOT, OR and AND from NOR gates.

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 →

What you need

Step by step

  1. Place inputs A and B and a probe Y.
  2. N1 = NOR(A, B). Then N2 = NOR(A, N1) and N3 = NOR(B, N1).
  3. NOR N2 with N3: that output is A XNOR B.
  4. Feed the XNOR into both inputs of a fifth NOR: its output is Y = A XOR B.
  5. Try all four rows: Y is 1 only when A and B differ.

XOR from NOR truth table

ABN1N2N3XNORY
0010010
0101001
1000101
1100010

N2 and N3 each catch 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.

Build more parts from gates

half adderfull adderhalf subtractorfull subtractor2:1 multiplexer4:1 multiplexerXOR gate from NAND gates2-to-4 decoderSR latchD flip-flopJK flip-flopT flip-flop4-bit shift register4-bit ripple carry adderD latch1-to-4 demultiplexer4-bit magnitude comparator4-bit ring counter4-bit Johnson counter4-to-2 priority encoder4-bit synchronous counter3-to-8 decoder8-to-1 multiplexer4-bit carry lookahead adderhalf adder from NAND gates2-bit comparatorBCD to 7-segment decoder4-bit up/down counterdecade counter2-bit multiplier4-bit ALU4-bit array multiplierNOT, AND, OR and NOR from NANDNOT, OR, AND and XOR from NORfull adder from NAND gatesSR latch from NAND gatesparity generator and checker4-bit adder/subtractorBCD adder4-bit universal shift registermod-6 counter4-bit ripple counterbinary to Gray code converterhalf adder from NOR gatesfull adder from NOR gates4-bit register with parallel load1011 sequence detectorbinary to BCD converterD flip-flop from NAND gates1-bit ALUCMOS inverterCMOS NAND gateCMOS NOR gatePISO shift registerSR flip-flop from NAND gatesBCD to excess-3 code converterHamming (7,4) code encoder and correctortraffic light controller4-bit barrel shifterCMOS AND gateCMOS OR gateCMOS XOR gate1-bit magnitude comparatorhalf subtractor from NAND gatesfull subtractor from NAND gates8-to-3 encoderGray to binary converter4-to-16 decoderfull adder using 4:1 multiplexersedge detectorserial adder4-bit carry-select adderMealy machine (1011 detector)master-slave JK flip-flop (NAND)half subtractor from NOR gates1-to-8 demultiplexerexcess-3 to BCD code convertervending machine FSM4-bit carry-save adder3-bit synchronous counter (JK)CMOS transmission gatetri-state buffer (CMOS)2-to-1 mux from transmission gatesmod-5 counterflip-flop conversion (JK to D)8-bit ALUdecimal to BCD encoderBCD to decimal decoder4-to-1 mux from 2-to-1 muxes

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 XOR gate from NOR gates in the lab →

Frequently asked

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

Five: four NOR gates make XNOR, and a fifth inverts it into XOR.

How many NOR gates make an XNOR gate?

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

Why does XOR take more NOR gates than NAND gates?

The four-gate NAND network computes XOR and its NOR dual computes XNOR. So NAND gets XOR in four gates, while NOR needs a fifth gate to invert its XNOR.