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.
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 | B | lhs | rhs |
|---|---|---|---|---|
| 0 | FALSE | FALSE | FALSE | FALSE |
| 1 | FALSE | TRUE | TRUE | TRUE |
| 2 | TRUE | FALSE | TRUE | TRUE |
| 3 | TRUE | TRUE | TRUE | TRUE |
The same law in four notations
A OR BA || BA ∨ BA + BA + BNAND(NAND(A, A), NAND(B, B))NAND(NAND(A, A), NAND(B, B))NAND(NAND(A, A), NAND(B, B))NAND(NAND(A, A), NAND(B, B))\overline{\overline{A \cdot A} \cdot \overline{B \cdot B}}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
- Boolean algebra calculator and simplifier with steps (every law named and verified)
- Logical equivalence checker: two expressions, exact verdict, counterexample
Practice
See also
- NOT from NAND: NOT A = NAND(A, A)
- AND from NAND gates: A AND B = NAND(NAND(A, B), NAND(A, B))
- De Morgan's laws: NOT (A AND B) = NOT A OR NOT B, with proof and examples
- XOR with four NAND gates, verified equivalent
- NAND vs NOR as the universal gate
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.