Logic Gates

The very basis of computers is binary. In electronics everything can be boiled down to 1s and 0s. Logic gates are digital circuits that take one or more binary inputs and produce a binary output. You can check out the basis of logic with Boolean Algebra.


There are seven basic logic gates that we are going to go over today.

symbols credit to Wikipedia
Image from Wikipedia.

For this blog post, you can see that most of the gates take two inputs (X and Y). NOT is the only exception, taking 1 input. Each of these gates has a related truth table and logic symbol (we will learn these later).



AND is a pretty simple. Unless X and Y are 1, 0 will be outputted.



NAND is the negation of AND. The output will always be 1 unless X and Y are 1, when the output will be 0.



OR is the inclusion of one or more inputs will create an output of 1. With OR, X and Y can be 1, and the output will be 1.



NOR is the negation of OR. If X or Y are 1, or X and Y are 1, then the output will be 0. In NOR, the only inputs to output 1 are when X and Y equal 0.


XOR is what some people assumed OR would, an exclusive OR. XOR will only produce the output 1 if there is only 1 between X and Y. Two 0s or two 1s will output 0.



XNOR is the inverse of XOR, meaning that only two 0s and two 1s will produce an output of 1. XNOR seems a lot closer to AND, but it is important to remember that it is the inverse of XOR.



NOT is the simplest logic gate. If a 1 is passed in, it becomes a 0. If 0 is passed in, it becomes 1.


These seven logic gates are pretty simple, but when used in conjunction with each other, they can be used to build integrated circuits!


About Josh

I love Coding!

View all posts by Josh →

One Comment on “Logic Gates”

  1. Hello Sir,
    I have found your post quite useful and I just wanted to know how can we construct an XOR logic gate by making use of other logic gates?

Leave a Reply

Your email address will not be published. Required fields are marked *