# What is a logic gate and what are its types?

## Logic gates

Logic gates are the basic building blocks of any digital system. Logic gates are electronic circuits. It has one or more inputs and only one output. The relationship between input and output is based on a particular logic.

In this, the input and output are in binary form, that is, the value of input / output will be only 0 (low) and 1 (high).

You can also read: What Is Boolean Algebra In Computer Science

## Types of logic gates

Generally, there are three types of logic gates –

1. AND gate
2. OR gate
3. NOT gate

There are many other types of logic gates which are based on these three logic gates. like :-

NAND GATE, NOR GATE, XOR gate.

## AND Gate

AND GATE has two or more inputs but only one output. The output of AND GATE is high only when all the inputs are high. AND GATE performs the multiplication operation on two or more inputs. The operation of AND GATE is represented by (.).

Ex: X= A AND B
X= AB

## OR GATE

OR GATE consists of two or more input signals and only one output signal. It is called OR GATE because the output is high when any one input or all the inputs are high. In OR GATE, addition operation is performed on two or more inputs. OR GATE operation is represented by (+) symbol.

Ex: X=A OR B
X= A+B

## Not Gate

NOT GATE has only one input and one output because its output state is opposite to the input state. That is, the input is high when the output is low. NOT GATE is also called complement, negation or inverter. The NOT GATE operation is displayed with a bar or (¯) symbol.

Ex: X = NOT A
X = A’

## NAND GATE

On adding an AND GATE with NOT GATE, a new GATE is obtained which is called NAND GATE. It performs NOT and AND operations. What is NAND GATE is a compliment (¯) of AND GATE.

Ex: X = A NAND B
X = (AB)’

## NOR GATE

It is a combination of NOT and OR GATE. The GATE obtained by adding a NOT GATE and an OR GATE is called NOR GATE. What is NOR GATE is a compliment to OR GATE.

Ex: X = A NOR B
X = (A+B)’

## XOR GATE

XOR GATE is widely used in digital circuits although it is not a basic operation but it can be constructed using basic GATES (AND, OR, NOT) or by using universal GATE (NAND or NOR).

XOR can be used in half adder, full adder, and subtractor. XOR is also called Ex-OR.