Introduction to DLD

XOR Gate Using NAND Gates

An XOR logic Gate can be made using NAND logic gates. As we know, NAND is a universal logic gate, meaning it can be used to build other basic logic gates such as NOT, OR, AND, NOR, XOR, and XNOR. Implementing an XOR gate using a NAND gate is useful when you need an XOR logic circuit but only have NAND gates available; an XOR logic gate is unavailable.

XOR Gate Using NAND Gate - Need XOR but not available

XOR Logic Gate

An XOR logic gate produces the output 1 (High) when its inputs are different. The output becomes 0 (Low) when all inputs are the same. For a 2-input XOR gate, the output is 1 when one input is 1 and the other input is 0. The XOR logic gate truth table and its symbol are given below.

XOR Logic Gate Truth Table (2-Inputs)

NAND Logic Gate

A NAND logic gate produces the output 0 (LOW) in only the case when all inputs are 1 (HIGH). For all other input combinations, the output is 1 (HIGH).The following are the NAND logic gate truth table and its symbols

XOR Gate Using NAND Gate - NAND Logic Gate

XOR Gate Using NAND Gates

If we want to construct a 2-input XOR logic gate using NAND gates, then 4-NAND gates are required to implement this process.

XOR Gate Using NAND Gate

Let’s explain it

STEP 01: First NAND Gate

First NAND gate takes two inputs, A and B, and generates the output (A · B)’ as shown in the following diagram

Step 1 - XOR Gate Using NAND Gate

This output is then connected to both the upper NAND gate and the lower NAND gate.

STEP 02: Upper NAND Gate

The upper NAND gate takes A as one input and the output of the first NAND gate, (A.B)’, as the other input. The following diagram explains the result of the upper NAND gate.

​ Step 2 - XOR Gate Using NAND Gate

STEP 03: Lower NAND Gate

The upper NAND gate takes B as one input and the output of the first NAND gate, (A.B)’, as the other input. The following diagram explains the result of the upper NAND gate.

Step 3 - XOR Gate Using NAND Gate

Step 4: Final NAND Gate

The final NAND gate takes the outputs of the upper NAND gate and the lower NAND gate as its inputs.

Step 4 - XOR Gate Using NAND Gate

XOR Gate Using NAND Gates – Truth Table

A 2-input XOR gate can be implemented using four NAND gates. The truth table below shows the output of the circuit for all possible combinations of inputs A and B.

XOR Gate Using NAND Gate - Truth Table