Logic Gate Visualizer
Simulate digital logic gates. Click inputs on the diagram to toggle.
Truth Table
| Input A | Input B | Output |
|---|
What are Logic Gates?
Logic gates are the fundamental building blocks of digital electronics. They are physical devices that implement Boolean functions, performing logical operations on one or more binary inputs (0 or 1) and producing a single binary output.
Every digital device you own—from your smartphone to your laptop—is essentially a massive collection of billions of microscopic logic gates. By combining simple gates like AND, OR, and NOT, engineers can create complex circuits capable of addition, memory storage, and running software.
How Logic Gates Work (Truth Tables)
The behavior of a logic gate is defined by its Truth Table, which lists all possible input combinations and their resulting output.
Common Gates
- AND Gate: Output is HIGH (1) only if both inputs are HIGH. Think of it like a safety lock requiring two keys.
- OR Gate: Output is HIGH if at least one input is HIGH. Like a hallway light with two switches.
- NOT Gate (Inverter): Output is the opposite of the input. A 1 becomes 0, and a 0 becomes 1.
- XOR Gate (Exclusive OR): Output is HIGH only if the inputs are different (one is 1, the other is 0). It is crucial for binary addition.
- NAND / NOR: Universal gates. By combining enough NAND gates, you can build any other type of gate.
Practical Applications
Logic gates operate at the heart of computing:
- ALUs (Arithmetic Logic Units): The part of a CPU that does math. An "Adder" circuit is built using XOR and AND gates.
- Flip-Flops & Memory: Gates configured with feedback loops can store data bits, forming the basis of RAM and SSDs.
- Control Systems: Simple logic circuits control traffic lights, elevator safety mechanisms, and washing machine cycles without needing a full computer.
FAQ
What is the difference between XOR and OR?
An OR gate outputs 1 even if both inputs are 1 (inclusive OR). An XOR (Exclusive OR) gate outputs 0 if both inputs are 1. Essentially, XOR strictly means "one or the other, but not both."
Are logic gates analog or digital?
Logic gates are digital components that process binary signals. However, physically they are built from analog transistors (MOSFETs) that are driven into saturation or cutoff states to represent 1s and 0s.
Why are NAND gates called "Universal"?
A NAND gate is called "Universal" because you can construct any other boolean function (AND, OR, NOT, etc.) using only a combination of NAND gates. This is why flash memory (like in USB drives) is built almost entirely from NAND cells.