XOR gate or Exclusive OR gate is a widely used logical gate in digital electronics. It is one of the logic gates in the Computer which is **available in IC form**. We have discussed **basic logic gates** like OR gate, AND gate and NOT gate earlier in other articles. XOR gate can be constructed by using only **basic logical gates**, **NAND gates** and **NOR gates** separately. In this article, we are going to discuss the XOR logic gate, its Boolean expression and Truth table. Then I will explain the XOR gat**e circuit diagram using only NAND gate or NOR gate**.

**Contents of this article:**

**What is XOR gate?****Boolean expression of XOR gate****Circuit diagram of XOR gate****Truth Table of XOR gate****XOR gate using NAND gate****XOR gate using NOR gate****Application of XOR gate**

**What is XOR gate?**

XOR gate is also known as the Exclusive OR gate or Ex-OR gate. It gives the output **1** (High) if an odd number of inputs is high. This can be understood in the Truth Table. It can have an infinite number of inputs and only one output. In most cases, two-input or three-input XOR gates are used.

**XOR gate** **Boolean expression**

We consider a two-input XOR gate with inputs **A** and **B**. If **Y** is the output of the gate then the **Boolean expression relating the inputs and the output** is,

or, Y=A\oplus B

This is the XOR gate formula. For the three input XOR logic gate, the XOR gate Boolean expression is Y=A\oplus B\oplus C, where A, B and C are the inputs.

**Circuit diagram of XOR logic gate** **using basic logic gates**

One can draw the circuit diagram for an XOR gate in many ways by using the different combinations of NAND, NOR, NOT, AND, OR gates. Also, the XOR logic circuit can be designed by using only NAND gates or only NOR gates which are discussed later. Here we have designed XOR logic circuit by using **basic logic gates** i.e. by using AND, OR and NOT gates. Figure-1 shows the XOR gate schematic diagram and figure-2 shows the symbol of XOR gate.

**Truth Table of XOR gate**

Table-1 and Table -2 are the Truth tables for XOR gate with two inputs and three inputs respectively.

Input (A) | Input (B) | Output, \small Y=A\overline{B}+\overline{A}B |

0 | 0 | 0 |

0 | 1 | 1 |

1 | 0 | 1 |

1 | 1 | 0 |

**Table-1 :**

**Truth Table for Two Input XOR gate**

Input (A) | Input (B) | Input (C) | Output, \small Y=A\oplus B\oplus C |

0 | 0 | 0 | 0 |

0 | 0 | 1 | 1 |

0 | 1 | 0 | 1 |

0 | 1 | 1 | 0 |

1 | 0 | 0 | 1 |

1 | 0 | 1 | 0 |

1 | 1 | 0 | 0 |

1 | 1 | 1 | 1 |

**Table-2: Truth Table for Three input XOR gate**

**XOR gate using NAND gate**

One can construct an XOR gate by using **a** **minimum of** **four NAND gates**. However, It is also possible to design an XOR gate using more than four NAND gates. Here, we will draw the circuit diagram of two input XOR gate by using four NAND gates.

### Derivation of the output of NAND gate-based XOR circuit

Here, **de Morgan theorem** and **Boolean Algebra** are used to derive the output equation of the above circuit of XOR gate using NAND gates. The used relations are \small\color{Blue}A.\bar{A} =B.\bar{B} = 0 and \small\color{Blue}\overline{AB} = \bar{A} + \bar{B}.

Let’s derive the output of the circuit!

- The leftmost NAND gate has inputs A and B and its output is \small\color{Blue}\overline{AB}.
- Inputs for the upper NAND gate are A and \small\color{Blue}\overline{AB} and the output is \small\color{Blue}\overline{A. \overline{AB}}.
- Again, the inputs for the lower NAND gate are B and \small\color{Blue}\overline{AB} and its output is \small\color{Blue}\overline{B. \overline{AB}}.
- Finally, the inputs for the last NAND gate at the rightmost side are the outputs of the upper and lower NAND gates i.e. \small\color{Blue}\overline{A. \overline{AB}} and \small\color{Blue}\overline{B. \overline{AB}}.

The final output is \small\color{Blue}Y = \overline{(\overline{A. \overline{AB}}).(\overline{B. \overline{AB}})}

or, \small\color{Blue} Y=\overline{\overline{A. \overline{AB}}}+ \overline{\overline{B. \overline{AB}}}

or, \small\color{Blue}Y = A. \overline{AB}+ B. \overline{AB}

or, \small\color{Blue}Y = (A+ B). \overline{AB}

or, \small\color{Blue}Y = (A+ B) (\bar{A}+\bar{B})

or, \small\color{Blue}Y = A.\bar{A}+A.\bar{B} + B.\bar{A} + B. \bar{B}

or, \small\color{Blue}Y = A.\bar{B} + \bar{A}.B

Thus the output of the above circuit is the same as the output of an XOR gate. Hence the above circuit represents the circuit diagram of Exclusive OR gate using NAND gates.

**XOR gate using NOR gate**

To design the circuit diagram of an XOR gate using only NOR gates, **minimum five NOR gates** are required. Also, one can develop the same with more than five NOR gates. Here is the schematic diagram of XOR gate using five NOR gates.

### Derivation of the output of NOR gate based XOR circuit

Now we are interested to check the output for this circuit too. Go through the following steps for this –

- The leftmost NOR gate has inputs A and B and its output is \small\color{Blue}\overline{A+B}.
- Inputs for the upper NOR gate are A and \small\color{Blue}\overline{A+B} and the output is \small\color{Blue}\overline{A+ (\overline{A+B})}.
- Again, the inputs for the lower NOR gate are B and \small\color{Blue}\overline{A+B} and its output is \small\color{Blue}\overline{B+ (\overline{A+B})}.
- The inputs for the 4th NOR gate are the outputs of the upper and lower NOR gates i.e. \small\color{Blue}\overline{A+ (\overline{A+B})} and \small\color{Blue}\overline{B+ (\overline{A+B})}.

The output of the 4th NOR gate = \small\color{Blue}\overline{(\overline{A+ \overline{A+B}})+(\overline{B+ \overline{A+B}})}

= \small\color{Blue}\overline{\bar{A}. (\overline{\overline{A+B}})+\bar{B}. (\overline{\overline{A+B}})}

= \small\color{Blue} \overline{\bar{A}. (A+B)+\bar{B}. (A+B)}

= \small\color{Blue}\overline{\bar{A}. A +\bar{A}.B +A.\bar{B}+\bar{B}.B}

= \small\color{Blue}\overline{\bar{A}.B +A.\bar{B}}.

Now, this is the input for the last or 5th NOR gate. This NOR gate gives the output as the inversion of its input. Hence the final output of the above circuit is, \small\color{Blue}Y = \overline{\overline{\bar{A}.B +A.\bar{B}}}

or, \small\color{Blue}Y = \bar{A}.B +A.\bar{B}.

This is the output of the XOR gate. Hence the above NOR gate-based circuit is the circuit of XOR gate.

Thus the output of the above circuit is the same as the output of an XOR gate. Hence the above circuit represents the circuit diagram of Exclusive OR gate using NAND gates.

**Application of XOR gate**

- XOR gate has wide uses in the
**arithmetic section of the computer**. - In the Truth Table of two input XOR gate, one can see that the circuit gives the output as high (
**1**) when inputs are unequal (when one is 0 and the other is**1**). Thus, a two-input XOR gate acts as an**inequality detector**.

This is all from this article on** XOR gate diagram and truth table**. If you have any doubts on this topic you can ask me in the comment section.

If you are looking for someone to help with your physics assignments, please delegate your **Do my physics homework for me** to experts from “**MyAssignmentLab**“.

Thank you!

**Related Posts:**

**XNOR gate using NAND gate and NOR gate only****Basic logic gates using NAND gates only****Basic logic gates with Truth Table and diagram – OR, AND, NOT gate****NAND gate****NOR gate**

## 8 thoughts on “XOR gate circuit diagram using only NAND or NOR gate”

Comments are closed.