Implementation of XOR Gate from NAND Gate
Last Updated :
03 Apr, 2025
Logic Gates are the building blocks of digital circuits, taking binary values as input and returning a binary value as output after performing a logical operation. There are several kinds of gates available in Digital Electronics like basic gates, and universal gates. Implementation of the XOR gate from the NAND gate is possible because the NAND gate is a Universal gate i.e., it can implement all other gates. The NAND gate gives the output 0 if all the inputs are 1 else it gives 1 for all other cases. XOR gate is a logic gate that gives output 1 when number of 1s in input are odd else it gives 0. In this article, we will explore the XOR gate, and NAND gate and implement the XOR gate from the NAND gate.
What is an XOR Gate?
In digital electronics, the XOR (Exclusive-OR) Gate is a combination of all three fundamental or basic gates (NOT, AND and OR gates). It receives two or more than two input signals but produces only one output signal. It results in a low (0) if the input bit pattern contains an even number of high(1) signals. The output is high (1) for an odd number of high (1) signals in the input bit pattern.
The XOR gate's behavior can be summarized as follows
Returns 1, if the number of logical high input is odd.
Returns 0. if number of logical high input is even.
The Boolean Expression of two input XOR Gate is as follows
Say we have two inputs, A and B and the output is called X, then the expression is:
X = A⊕B = A’B + AB’
2 Input XOR GateLogic Diagram of Three Input XOR Gate
The logic circuit diagram of the XOR gate is shown in the following figure. It has three input line denoted by the letter A, B, C and one output line denoted by the letter X, where X=A⊕B⊕C.
3 Input XOR GateHere, we can see that when the number of 1s in the input is odd, the output is also 1.
Say we have N inputs, A0, A1, ...., AN and the output is called X, then the expression is:
X=A0⊕A1⊕.....⊕AN.
What is a NAND Gate?
NAND Gate is a combination of AND and NOT Gate. In this gate, a NOT Gate is applied at the output of an AND Gate. It receives two or more than two input signals but results in only one output signal which is complement of product of all the input signals. This is the reason that a NAND Gate is also referred as complemented AND Gate or Inverted AND Gate.
The NAND gate's behavior can be summarized as follows
Returns 1, if all the inputs are 0 or alternative (meaning one is 0, and the other is 1 or vice versa).
Returns 0, if all inputs are 1.
The Boolean expression of two input NAND Gate is as follows
Say we have two inputs, A and B and the output is called X, then the expression is:
X = (A . B)’
2 Input NAND GateLogic Diagram of Three Input NAND Gate
The logic circuit diagram of the NAND gate is shown in the following figure. It has three input lines denoted by the letter A, B and C and one output line denoted by the letter X, where
X= (A.B.C)'
3 Input NAND gateImplementation of XOR Gate from NAND Gate
Expression of XOR gate: A'.B + A.B'
To convert the expression into NAND form perform the following:
Apply double complement: [(A'.B + A.B')']'
Operate internal complement: [ (A'.B)' . (A.B')' ]'
Now, expression is obtained in NAND form.
Pass Input A through the first NAND Gate to get A', now pass this A' and B through the second NAND Gate to get (A'.B)'. Similarly, pass Input B through the third NAND Gate to get B', now pass this B' and A through the fourth NAND Gate to get (A.B')'. Pass both the output (A'.B)' and (A.B')' through the fifth NAND Gate to get our desired expression of XOR Gate ((A'.B)'.(A.B')')' = A'B + AB' (By De-Morgans Law).
Logic diagram
The Logical Diagram of the Following Expression is shown below
XOR Gate from NAND GateConclusion
The use of NAND Gates to achieve the logical XOR operations demonstrates the efficiency, usability and adaptability of NAND Gates in simplifying circuit design and also provides valuable insights into the fundamental principles of digital electronics. With just five NAND gates, we can construct XOR gate. This process also involves the application of De Morgan’s law to convert the expressions. It shows how a logic function can be simplified using universal gates, reducing the complexity and cost.
Similar Reads
Implementation of OR Gate from NAND Gate
Logic gates are an essential component of digital electronics and are used to handle binary data. Because of its universal nature, the NAND gate is particularly significant among these gates. This article explores the use of NAND gates to implement an OR gate, demonstrating the adaptability and usef
4 min read
Implementation of XOR Gate from NOR Gate
Implementation of the XOR gate from the NOR gate is possible because the NOR gate is a Universal gate i.e., it can implement all other gates. The NOR gate gives the output 1 if all the inputs are 0. XOR gate is a logic gate that gives output 1 when several 1s are odd. In this article, we will explor
4 min read
Implementation of NOR Gate from NAND Gate
Implementation of the NOR gate from the NAND gate is possible because NAND is a Universal gate i.e., it can implement all other gates. The NAND gate gives output low when all the inputs are high whereas the NOR gate gives output high when all inputs are low. In this article, we will implement the NO
5 min read
Implementation of OR Gate from NOR Gate
The Logic gates are the Fundamental Building Blocks of the Digital Circuits. The Logic Gate takes one or more Binary inputs and performs logical Operations to Produce a single binary Output. Understanding through the Different Combinations of gates is important for the Designer to produce the desire
5 min read
Implementation of AND Gate from NAND Gate
It is worth mentioning that Boolean algebra is a fundamental part of the digital electronics field that uses binary variables and logical operations. Think of it as the mind that makes the computers work effectively. Then, imagine that logic gates (AND, OR, and NOT) could be the necessary helpers in
5 min read
Implementation of XNOR Gate from AOI Gate
Digital electronics revolve around storing data in bits of 1s and 0s. Not only is digital electronics an efficient way of storing data but it also makes it easier to encrypt and secure our data. It is awesome how we can use different logic gates to implement some functions and represent these equati
6 min read
Implementation of AND Gate from NOR Gate
Digital electronics revolves around storing data in bits of 1s and 0s. Not only is digital electronics an efficient way of storing data but it also makes it easier to encrypt and secure our data. It is awesome how we can use different logic gates to implement some functions and represent these equat
4 min read
Implementation of XOR Gate from AND, OR and NOT Gate
In this article, we will discuss the implementation of XOR gate using AND, OR and NOT Gate. We will discuss about the AND, OR, XOR and NOT gates, and with it, we will discuss about their operations, logic diagrams and truth table. After understanding the gates and their operation we will use those g
5 min read
Implementation of NOT Gate using NAND Gate
A universal gate is a logic gate that can be used to implement other types of logic gates. In other words, using a universal gate, you can do all the simple operations like AND, OR, NOT, NAND, and NOR. The two most general purpose NAND gates and NOR gates. These gates are considered universal becaus
5 min read
Implementation of NOT Gate using NOR Gate
Understanding the concept of logic gates is Fundamental to understanding digital logic circuits. Logic gates are the building blocks of digital circuits responsible for performing the logical operations on binary inputs(0s and 1s) to produce a binary Output. There are many gates such as AND, OR, NOT
5 min read