Logic gates are the basic building blocks of every digital circuit. A logic gate takes one or more binary inputs (0 or 1) and produces a single binary output according to a fixed Boolean rule. Every processor, memory and digital chip is built from millions of these gates wired together. This guide covers the seven standard gates — AND, OR, NOT, NAND, NOR, XOR and XNOR — with their symbols, Boolean expressions and truth tables.
What is a logic gate?
A logic gate is a physical device (built from transistors) that implements a Boolean function. Inputs and output take only two values — logic 0 (low voltage) and logic 1 (high voltage). Because the behaviour is fully defined by a truth table, gates can be combined to build any digital function, from a simple adder to a complete CPU.
The three basic logic gates
AND gate
The output is 1 only when all inputs are 1. Boolean expression: Y = A · B.
| A | B | Y = A·B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
OR gate
The output is 1 when at least one input is 1. Boolean expression: Y = A + B.
| A | B | Y = A+B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
NOT gate (inverter)
A single-input gate that outputs the opposite of its input. Boolean expression: Y = A'.
| A | Y = A’ |
|---|---|
| 0 | 1 |
| 1 | 0 |
The universal and derived gates
NAND gate
AND followed by NOT: output is 0 only when all inputs are 1. Y = (A · B)'. NAND is a universal gate — any Boolean function can be built from NAND gates alone.
| A | B | Y = (A·B)’ |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
NOR gate
OR followed by NOT: output is 1 only when all inputs are 0. Y = (A + B)'. NOR is also a universal gate.
| A | B | Y = (A+B)’ |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
XOR gate (exclusive-OR)
Output is 1 when the inputs differ. Y = A ⊕ B = A'B + AB'. XOR is the core of adders and parity circuits.
| A | B | Y = A⊕B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
XNOR gate (exclusive-NOR)
Output is 1 when the inputs are equal — the complement of XOR. Y = (A ⊕ B)'. Used as an equality/comparator element.
| A | B | Y = (A⊕B)’ |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Why NAND and NOR are called universal gates
Any logic function can be implemented using only NAND gates or only NOR gates. For example, a NOT is a NAND with both inputs tied together, and AND is a NAND followed by a NAND-inverter. This is why standard-cell libraries and real chips lean heavily on NAND/NOR — they are compact in CMOS and functionally complete.
How do you learn to design with logic gates?
Start with truth tables and Boolean algebra, then move to combinational and sequential design in an HDL. ChipXpert’s RTL Design course takes you from gates to synthesizable Verilog. For the next topics, see our guides on Boolean algebra, universal gates and the Karnaugh map.
FAQs on logic gates
What are the 7 basic logic gates?
AND, OR, NOT, NAND, NOR, XOR and XNOR. AND, OR and NOT are the three fundamental gates; NAND, NOR, XOR and XNOR are derived from them.
Which logic gates are universal?
NAND and NOR. Each can implement any Boolean function on its own, so any circuit can be built using only NAND gates or only NOR gates.
What is the difference between XOR and OR?
OR outputs 1 when at least one input is 1 (including both). XOR outputs 1 only when the inputs are different — it outputs 0 when both inputs are 1.
Why are NAND gates preferred in chip design?
In CMOS, NAND gates are compact, fast and functionally complete, so synthesis tools map much of a design onto NAND/NOR cells for area and performance efficiency.
Related digital electronics topics
- JK Flip-Flop: Truth Table & Working
- T Flip-Flop: Truth Table & Circuit
- D Flip-Flop & D Latch
- SR Latch (NAND & NOR)
- Karnaugh Map (K-Map)
- Full Adder & Half Adder
- Universal Gates: NAND & NOR
- Finite State Machines (FSM)
- Sequential Circuits
- Shift Registers (SISO/SIPO/PISO/PIPO)
- 4:1 Multiplexer
- Encoders & Decoders
- Binary to Gray Code Conversion
- One's & Two's Complement
- Counters in Digital Electronics
- Demultiplexer (DEMUX)
- Boolean Algebra & De Morgan's Theorem
- Number Systems (Binary, Octal, Hex)
- Combinational Circuits
- Half Subtractor & Full Subtractor
- Latch vs Flip-Flop
- Setup Time & Hold Time
- Master-Slave Flip-Flop
- Ring Counter & Johnson Counter
- Digital Comparator
Share your question in comments or talk to our mentor team for batch guidance.
Ask the Admin Team
Drop your basic question in comments: eligibility, prerequisites, tools, fee range, and placement support.
Our team reviews and responds regularly.
