NAND

Inputs

PinTypeDescription
AbitFirst input signal
BbitSecond input signal

Outputs

PinTypeDescription
QbitResult: 0 only when A=1 and B=1

How It Works

NAND is AND with an inverter bubble on the output: first ordinary bit multiplication, then the opposite. The result is a skeptic who almost always says "yes" — and a single combination, a one on both inputs, forces it to say "no".

The key property: the output is 0 only when A=1 and B=1; in every other case it is 1. Example: a conveyor stop signal that fires only when both emergency buttons are pressed — in any other situation the conveyor keeps running.

NAND's real fame is universality. Join the inputs — you get NOT. Add a NOT on the output — you get AND. By De Morgan, three NANDs make an OR. In the game NAND is the very first basic element: from Level 1 the whole logic part of the course is built from this single part, just as a real computer is built from one type of transistor circuit.

Truth Table and Examples

ABQ
001
011
101
110

Universality in action: feed the same signal into both inputs and the NAND becomes an inverter. A=1, B=1 gives 0; any other combination gives 1. The "spare" gate turns into the most needed one for free.

Usage

NAND is available from the very start and serves as raw material for the early levels: NOT (Level 2) is a NAND with joined inputs, AND (Level 3) is NAND plus NOT, OR (Level 4) is three NANDs via De Morgan. Even XOR (Level 5) assembles from four NANDs. While the palette is sparse, NAND is your main tool.

Outside the game the word NAND is familiar to everyone from flash memory: SSDs and USB drives are built on NAND cells. The reason is the same as in the game: in silicon an inverting gate is simpler and faster than a non-inverting one, and mass-producing a single circuit type is cheaper than producing many different ones.

Interactive Demo

Click inputs to toggle value (0 / 1)

Build it yourself →

Related components

Related articles

Frequently Asked Questions

Why is NAND called universal?

Any other logic element — NOT, AND, OR and XOR — can be built from NAND gates by combining two or more of them.

How does NAND differ from AND?

NAND is AND with an inverted output: it gives 0 only when A=1 and B=1, and 1 in all other cases.

How do I build OR from NAND?

Three gates: a NOT (that is, a NAND with joined inputs) on each signal, then a final NAND. By De Morgan this is exactly OR.

Why is NAND cheaper than AND in real chips?

In silicon, output inversion is nearly free, while a non-inverting AND is still built from NAND and NOT. One gate type keeps manufacturing simpler and cheaper.