Digital Logic Gates: The Fundamental Guide
Understand the microscopic switches that make computers think. A complete guide to AND, OR, NOT, and XOR gates.
What are Logic Gates?
Logic gates are the basic building blocks of any digital system. They operate on binary numbers (0s and 1s) to perform logical operations. Think of them as electronic decision-makers: they take input signals and produce an output based on specific rules.
1. AND Gate (The "All or Nothing")
The output is HIGH (1) only if ALL inputs are HIGH.
| Input A | Input B | Output (Y) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Analogy: To unlock a safe with two keys, you need Key A AND Key B.
2. OR Gate (The "Any One")
The output is HIGH (1) if ANY input is HIGH.
| Input A | Input B | Output (Y) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Analogy: You can enter the house if you have the front door key OR the back door key.
3. NOT Gate (The "Inverter")
Also known as an inverter. It simply flips the input. 0 becomes 1, and 1 becomes 0.
| Input A | Output (Y) |
|---|---|
| 0 | 1 |
| 1 | 0 |
4. XOR Gate (Exclusive OR)
The output is HIGH (1) only if the inputs are DIFFERENT.
| Input A | Input B | Output (Y) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Analogy: A two-way light switch. Flipping either switch changes the state (light on/off).
Universal Gates (NAND & NOR)
NAND and NOR gates are called "Universal Gates" because you can build ANY other logic gate (AND, OR, NOT) using only combinations of NANDs or only NORs.
NAND Gate (Not AND)
Output is LOW only if all inputs are HIGH. It is the exact opposite of AND.
NOR Gate (Not OR)
Output is HIGH only if all inputs are LOW. It is the exact opposite of OR.