Skip to content
LearnTronics menu

LearnTronics

NAND, NOR, and XNOR Gates

Tutorial Index

Invert a gate's output

The bubble convention lets us create three more familiar gates without learning three completely unrelated shapes.

NAND Y = ~(A • B) + NOR Y = ~(A + B) XNOR Y = ~(A ⊕ B) The output bubble means: perform the gate function, then invert it. AND + bubble = NAND     OR + bubble = NOR     XOR + bubble = XNOR

NAND — NOT AND

Y = ~(A • B)

NAND is 0 only when both A and B are 1.

NOR — NOT OR

Y = ~(A + B)

NOR is 1 only when both A and B are 0.

XNOR — NOT XOR

Y = ~(A ⊕ B)

For two inputs, XNOR is 1 when the inputs are the same. That is why it is also useful as an equality detector.

Compare their truth tables

ABNANDNORXNOR
00111
01100
10100
11001

Why NAND and NOR matter so much

NAND and NOR are called universal gates. Either type can be combined to build NOT, AND, OR, and ultimately any Boolean function. That makes them especially important in digital circuit design.

Try these yourself

A NAND gate is best described as: NAND Y = ~(A • B) + NOR Y = ~(A + B) XNOR Y = ~(A ⊕ B) The output bubble means: perform the gate function, then invert it. AND + bubble = NAND     OR + bubble = NOR     XOR + bubble = XNOR
NAND means NOT-AND: first AND the inputs, then invert the result.
What does an output bubble on an OR-shaped gate make?
OR with its output inverted is NOR.
When is XNOR true for two inputs?
XNOR is the inverse of XOR, so it is 1 when both inputs have the same logical value.