Home › Lessons › Digital logic › NAND as a universal gate

NAND as a universal gate

Digital logic · Beginner · about 10 minutes · part of Zen’s Electronics Design Mastery

Using only NAND gates you can make NOT, AND and OR, and therefore any logic circuit. Here one 74HC00 makes NOT A (a NAND with its inputs tied together) and A OR B (inverting both inputs, then NANDing them: De Morgan’s law).

NAND as a universal gate: the circuit on the simulator's bench

Open this lesson in the labFree, in your browser, no account needed.

How it works

NOT A = (A · A)̅  ·  A + B = (A̅ · B̅)̅ (De Morgan)

ABA+BA̅bench
0001—
0111—
1010—
1110—

Flip the switches to try every row. “bench” fills in with what the chip actually did.

Gates 1 and 2 invert A and B, gate 3 NANDs the results, which gives OR. Gate 4 on its own is a NOT. AND would be NAND followed by a NAND-inverter.

Try it on the bench

  1. Step through all four input combinations and check the OR column fills exactly like a real OR gate.
  2. Follow the blue wires: each one carries an inverted input into the last NAND.

Parts on the bench

In the course

Zen’s Electronics Design Mastery, module “Digital Electronics”.

More on digital logic