Logic Gates: Symbols, Truth Tables and Expressions
All seven logic gates with their ANSI and IEC symbols, Boolean expressions, truth tables and a common 74-series chip, plus how to build everything from NAND or NOR gates.
AND gate
Y = A · B
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Output is 1 only when every input is 1.
TTL/CMOS example: 7408 (quad 2-input AND)
OR gate
Y = A + B
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Output is 1 when at least one input is 1.
TTL/CMOS example: 7432 (quad 2-input OR)
NOT gate
Y = A'
| A | Y |
|---|---|
| 0 | 1 |
| 1 | 0 |
Inverter: the output is the opposite of the input.
TTL/CMOS example: 7404 (hex inverter)
NAND gate
Y = (A · B)'
| A | B | Y |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
AND followed by NOT: 0 only when every input is 1. Universal: any circuit can be built from NANDs alone.
TTL/CMOS example: 7400 (quad 2-input NAND)
NOR gate
Y = (A + B)'
| A | B | Y |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
OR followed by NOT: 1 only when every input is 0. Also universal.
TTL/CMOS example: 7402 (quad 2-input NOR)
XOR gate
Y = A ⊕ B
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Exclusive OR: 1 when the inputs differ. With more inputs, 1 when an odd number of inputs are 1 (parity).
TTL/CMOS example: 7486 (quad 2-input XOR)
XNOR gate
Y = (A ⊕ B)'
| A | B | Y |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Equivalence: 1 when the inputs are equal. Used in comparators.
TTL/CMOS example: 74266 (quad 2-input XNOR)
Building NOT, AND and OR from NAND gates
- NOT: tie both inputs together: (A · A)′ = A′.
- AND: a NAND followed by a NAND-inverter: ((A · B)′)′ = A · B.
- OR: invert both inputs with NAND-inverters, then NAND them: (A′ · B′)′ = A + B by De Morgan.
A two-level sum of products maps directly onto two levels of NAND gates: replace every AND and the final OR by NANDs. AB + CD = ((AB)′ · (CD)′)′. Minimize the SOP first with the K-map solver, and the NAND circuit shrinks with it.
Building NOT, AND and OR from NOR gates
- NOT: (A + A)′ = A′.
- OR: a NOR followed by a NOR-inverter.
- AND: invert both inputs, then NOR: (A′ + B′)′ = A · B.
The dual rule holds: a product of sums becomes two levels of NOR gates, so a minimal POS gives a minimal NOR–NOR circuit.
Truth tables for more inputs
AND and OR extend naturally to any number of inputs. A 3-input XOR is 1 when an odd number of inputs is 1, which is why chained XOR gates compute parity. To see the table of any combination of gates, type its expression into the truth table generator, for example (A nand B) nand (A nand B).
Frequently asked questions
What are the 7 basic logic gates?
AND, OR and NOT are the basic operations; NAND, NOR, XOR and XNOR are the derived gates usually listed with them. Every gate has a symbol, a Boolean expression and a truth table, all shown above.
Why are NAND and NOR called universal gates?
Because NOT, AND and OR can each be built from NAND gates alone (or from NOR gates alone), and every Boolean function can be written with NOT, AND and OR. A NOT is a NAND with both inputs tied together; an AND is a NAND followed by that NOT; an OR is a NAND whose inputs are first inverted (De Morgan).
What is the difference between XOR and OR?
They differ only when both inputs are 1: OR gives 1 (“inclusive or”), XOR gives 0 (“one or the other, not both”).
What do the IEC symbols mean?
IEC 60617 draws every gate as a rectangle with a qualifying symbol inside: & for AND, ≥1 for OR (at least one input is 1), =1 for XOR (exactly one input is 1) and 1 for a buffer or inverter. A small circle on the output marks an inverted output.
Related tools and guides
- Truth table generator Generate the truth table of any Boolean expression (AND, OR, NOT, XOR, NAND, NOR, →, ↔) with step columns, minterms, SOP/POS and CSV or LaTeX export.
- Boolean simplifier Simplify a Boolean expression step by step: De Morgan, distributive, absorption, consensus and more, ending on a proven minimal SOP, plus the minimal POS.
- K-map solver Free K-map solver for 2 to 6 variables: enter cells, minterms, a truth table or an expression, add don't-cares, and get every minimal SOP and POS with steps.
- Boolean algebra laws Every Boolean algebra law in one table (identity, complement, De Morgan, absorption, consensus…) with dual forms, truth-table proofs and examples.