Skip to content

OR from NAND gates: A OR B = NAND(NAND(A, A), NAND(B, B))

OR from NAND gates: A OR B = NAND(NAND(A, A), NAND(B, B)), a NAND of the two inverted inputs.

Engine name: OR as NANDFR: OR en NANDDE: OR als NAND

OR is built as a NAND of the two negated inputs, each negation being a NAND with tied inputs.

By De Morgan, A OR B is NOT (NOT A AND NOT B), which is a NAND of NOT A and NOT B. Each inverter is a tied NAND, so three gates build an OR. This is the construction that completes the proof that NAND is universal: NOT, AND and OR are all available, and every Boolean function can be written with those three.

The same reasoning with OR and NOR gives the NOR family its AND, and the comparison page counts how many gates each family needs for the same expression. The worked example of XOR from four NANDs shows that hand design can beat the mechanical construction: the engine's converter produces more gates for XOR, and the page proves both circuits equivalent.

The four-row proof is below.

Statement

A OR B = NAND(NAND(A, A), NAND(B, B))

Proof by truth table: A OR B = NAND(NAND(A, A), NAND(B, B))

A OR B = NAND(NAND(A, A), NAND(B, B))
#ABlhsrhs
0FALSEFALSEFALSEFALSE
1FALSETRUETRUETRUE
2TRUEFALSETRUETRUE
3TRUETRUETRUETRUE
lhs ≡ rhs holds · lhs and rhs agree on every assignment. · Exhaustively checked and solver cross-checked · 4 rows

The same law in four notations

WordsA OR B
ProgrammingA || B
MathematicalA ∨ B
AlgebraA + B
LaTeXA + B
WordsNAND(NAND(A, A), NAND(B, B))
ProgrammingNAND(NAND(A, A), NAND(B, B))
MathematicalNAND(NAND(A, A), NAND(B, B))
AlgebraNAND(NAND(A, A), NAND(B, B))
LaTeX\overline{\overline{A \cdot A} \cdot \overline{B \cdot B}}
A OR B = NAND(NAND(A, A), NAND(B, B)) A OR B = NAND(NAND(A, A), NAND(B, B)) A B lhsPRIMARY rhs OR NAND NAND NAND
A OR B = NAND(NAND(A, A), NAND(B, B)) A OR B = NAND(NAND(A, A), NAND(B, B)) A B lhsPRIMARY rhs OR NAND NAND NAND

The common slip

Using NAND(A, B) as an OR. It is false only when both inputs are true; an OR is false only when both are false. The inverted inputs are what turn one into the other.

Questions

How many NAND gates does a basic gate need?

NOT: 1. AND: 2. OR: 3. XOR: 4 by hand (the classic circuit) and more by mechanical construction. The converter reports the count for any expression.

Related

Lesson that teaches this

Tools

Practice

See also

Laws

Generated from the Tangibool engine, semantics tangibool-semantics/1, engine 1.0.0, build . Every table, map, simplification and verdict on these pages was computed by the Tangibool engine when the site was built, and every claim was re-checked by the same exact checker the app uses. Limits are stated where they apply. © 2026 Foreranger LTD.