Table of Contents
ToggleDigital Logic Gates Explained: AND, OR, NOT, NAND, NOR, XOR, XNOR Truth Tables
Every calculation a computer has ever performed reduces to combinations of these seven simple building blocks, each one just deciding whether to pass a 1 or a 0.
Logic gates are the fundamental building blocks of every digital circuit, from a simple alarm system to a microprocessor. This guide covers all seven basic gates, AND, OR, NOT, NAND, NOR, XOR, and XNOR, with truth tables, the two universal gates, and where each one actually gets used.
What is a Logic Gate?
A logic gate is a basic electronic circuit with one or more binary inputs and a single binary output, where the output depends entirely on a fixed logical rule applied to the inputs. Each input and output can only be one of two states, commonly called HIGH and LOW, 1 and 0, or True and False. Logic gates are the fundamental building blocks of all digital electronics, from simple counters to the billions of transistors inside a modern microprocessor.
Physically, gates are built from transistors, most commonly using CMOS technology today, though early designs used diode-transistor or resistor-transistor logic. Regardless of implementation, every gate's behavior is completely described by its truth table, a simple list of every possible input combination and the output it produces.
Real Life Example
Think of an AND gate like needing two separate keys turned simultaneously to launch a missile system, both must be true for the action to occur.
An OR gate is more like a doorbell with two buttons, front and back, either one rings the same bell.
A NOT gate is a light that turns off exactly when you flip its switch on, and on when you flip it off, always the opposite of its input.

The Seven Basic Logic Gates
AND Gate
Output is HIGH only when every input is HIGH.
| A | B | Out |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
OR Gate
Output is HIGH when at least one input is HIGH.
| A | B | Out |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
NOT Gate (Inverter)
Single input, output is always the opposite of the input.
| A | Out |
|---|---|
| 0 | 1 |
| 1 | 0 |
NAND Gate (Not-AND)
Output is LOW only when every input is HIGH. A universal gate.
| A | B | Out |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
NOR Gate (Not-OR)
Output is HIGH only when every input is LOW. A universal gate.
| A | B | Out |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
XOR Gate (Exclusive OR)
Output is HIGH only when the inputs are different from each other.
| A | B | Out |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Comparison of Basic Logic Gates
Why NAND and NOR are Called Universal Gates
Both NAND and NOR gates can each, entirely on their own, reproduce the function of every other basic gate, including AND, OR, NOT, and even XOR, simply by wiring multiple copies of the same gate together in the right pattern. Connecting both inputs of a NAND gate together, for instance, turns it into a simple inverter (NOT gate). This property makes NAND and NOR extremely valuable in chip manufacturing, since a fabrication process can standardize on producing just one gate type and still build any digital logic circuit imaginable from it.
Applications of Logic Gates
Arithmetic Circuits
XOR and AND gates combine to build binary adders inside every processor's ALU.
Memory Circuits
NOR and NAND gates form the SR latches that store single bits of data.
Access Control Systems
AND gates ensure multiple conditions, like a key and a code, must both be satisfied.
Alarm and Safety Circuits
OR gates trigger an alarm if any one of several sensors detects a problem.
Error Detection
XOR gates compare bits to detect transmission errors and generate parity bits.
Microprocessor Design
Billions of NAND and NOR gate equivalents form the logic inside every modern CPU.
Digital Logic Gates: Video Walkthrough
Frequently Asked Questions About Logic Gates
- Microprocessor and Integrated Circuit: 4 Key Differences Every Engineer Should Know
- Introduction to Number Systems: Decimal, Binary, Octal and Hexadecimal Explained
- IEC 61131-3 Programming Languages Compared
- 9 Vital Types of Electronic Switches Every Engineer Should Know
- 555 Timer IC Explained: Astable, Monostable, and Bistable Modes
- Electronics Tutorials, Logic NOR Gate Tutorial
- GeeksforGeeks, XOR Gate: Truth Table, Logic Diagram, Implementation
- Build Electronic Circuits, NOR Gate: Logic Gates Tutorial
What We Learn Today
- Logic gates are the fundamental building blocks of all digital circuits, each following a fixed truth table rule
- AND, OR, and NOT are the three fundamental gates, while NAND, NOR, XOR, and XNOR are built from combinations of them
- NAND and NOR are each individually universal, able to reproduce every other gate's function on their own
- XOR detects differing inputs, XNOR detects matching inputs, both essential for arithmetic and error detection
- Modern microprocessors are ultimately built from billions of these same seven basic gate types
