Logic gates and truth tables

All seven gates with their truth tables and symbols, why NAND builds everything, De Morgan's theorem, and the wiring rules for real 74-series chips.

6 min readUpdated 2 Sept 2026
ShareWhatsApp

A logic gate is a circuit whose output depends only on the present state of its inputs, where every signal is one of two voltages. Call them 1 and 0, high and low, true and false — the algebra is the same, and it is the algebra George Boole wrote down in 1854, decades before there was anything electrical to apply it to.

The three that matter

AND, OR and NOT are enough to build every other gate, and every digital circuit that has ever existed.

AND — output is 1 only when every input is 1.
ABA AND B
000
010
100
111

Written A.B or AB. Think of two switches in series: both must close.

OR — output is 1 when any input is 1.
ABA OR B
000
011
101
111

Written A + B. Two switches in parallel: either one will do.

NOT — one input, output is its opposite. Also called an inverter.
ANOT A
01
10

Written A with a bar over it, or A'.

The inverted pair: NAND and NOR

Put a NOT on the output of an AND and you get NAND; on an OR, you get NOR. On a symbol this is drawn as a small circle — a bubble — on the output, and that bubble always means the same thing: invert.

NAND — the exact opposite of AND. Output is 0 only when all inputs are 1.
ABA NAND B
001
011
101
110
NOR — the opposite of OR. Output is 1 only when everything is 0.
ABA NOR B
001
010
100
110

The odd pair: XOR and XNOR

Exclusive-OR is 1 when the inputs are different. It is the gate that adds — the sum bit of a binary addition is just A XOR B — and the gate that compares.

XOR — different inputs give 1.
ABA XOR B
000
011
101
110

Written with a plus inside a circle. Also readable as: is exactly one of them 1?

XNOR — the same inputs give 1. An equality detector.
ABA XNOR B
001
010
100
111

Reading the symbols

The four gate outlines. AND has a flat back and a round nose, OR has a curved back and a pointed nose, XOR adds a second curve behind it, and NOT is a triangle with a bubble.ANDORXORNOT
Learn them by outline: flat back and round nose is AND, curved back and pointed nose is OR, a second curve behind it is XOR. A bubble on the output makes any of them the inverted version.
  • Flat back, curved front — AND. It looks like the D of "AND".
  • Curved back, pointed front — OR.
  • A second curve at the back — XOR.
  • A triangle — a buffer, which does nothing but drive harder. With a bubble it is a NOT.

De Morgan's theorem

Two identities that let you swap any AND for an OR, and they are how a circuit gets simplified on paper before anybody buys a chip.

NOT(A AND B) = (NOT A) OR (NOT B)

A NAND is an OR with both inputs inverted.

NOT(A OR B) = (NOT A) AND (NOT B)

A NOR is an AND with both inputs inverted.

In symbols the rule is easy to remember: break the bar and change the sign. Push a bubble through a gate and the gate changes shape. It matters practically, because it lets you rebuild a design around whichever chip you actually have in the drawer.

Real chips, and the rules for wiring them

The 74-series parts you are most likely to be given.
PartContains
7400Four 2-input NAND gates
7402Four 2-input NOR gates
7404Six inverters
7408Four 2-input AND gates
7432Four 2-input OR gates
7486Four 2-input XOR gates

In every one of these 14-pin packages, pin 7 is ground and pin 14 is Vcc. Learn that pair and half the wiring is done.

  1. 1

    Never leave an input floating

    An unused input on a CMOS gate drifts into the undefined region, and the gate then oscillates and draws heavy current — chips have been destroyed this way. Tie every unused input to Vcc or ground, whichever suits the gate. On an unused gate, tie its inputs anywhere valid.

  2. 2

    Decouple every package

    100 nF between Vcc and ground, right at the chip. Gates switch fast and pull a current spike from the supply as they do, and on a breadboard the wiring inductance turns that spike into a voltage dip that other gates read as a real input.

  3. 3

    Never connect two outputs together

    If one drives high and the other low you have created a short across the supply, through both chips. This is not like tying inputs together. Use a gate, or a part explicitly built for it with an open-collector or three-state output.

  4. 4

    Match the family before you mix

    74LS is TTL and 74HC is CMOS, and their input thresholds differ. A 74HC input needs to get within about a volt of the rail to read as a 1, and a 74LS output does not always manage it. 74HCT exists precisely to bridge the two.

What you need for this

Everything above works with parts from anywhere. These are what we stock, if it is easier.

Read next

Written by us for projectkit.in. If you spot something wrong, tell us — a reference page that is confidently wrong is worse than no page, and we would rather hear it from you than from a viva panel. Back to the Knowledge Base.

WhatsApp