NAND / NOR Converter

Type a Boolean expression and get it rebuilt from NAND gates alone and from NOR gates alone, with the gate count of each form beside the ordinary AND-OR version.

NOT A' · AND AB · OR A + B · XOR A ^ B · minterms Σm(1, 3, 5) or 1,3,5

Try

How to use the NAND and NOR converter

  1. Type the expression, or a list of minterms. The converter first reduces it to its minimal sum of products.
  2. Compare the three forms. The table shows the AND / OR / NOT form, the NAND-only form and the NOR-only form, each with the number of gates it needs.
  3. Pick the one that suits your parts. A NAND-only design can be built entirely from 74LS00 chips; a NOR-only design from 74LS02 chips.

Why NAND and NOR are universal gates

NAND and NOR are called universal gates because any logic function can be built from either one alone. A NAND with its inputs tied together is an inverter; a NAND followed by that inverter is an AND; and by De Morgan's theorem a NAND of inverted inputs is an OR. The same holds for NOR with the roles of AND and OR swapped.

That matters on a breadboard. An AND-OR circuit usually needs three kinds of chip — AND, OR and inverter — with most of each package left unused. The same function in NAND gates may need more gates but only one kind of chip, which often means fewer packages and less wiring.

Converting a sum of products to NAND gates

A sum of products converts to NAND gates almost for free. Take F = AB + C. Complement it twice, which changes nothing: F = ((AB + C)')'. Apply De Morgan's theorem to the inner complement: F = ((AB)' · C')'. Every bar is now over a product, so every bar is one NAND gate: one makes (AB)', one inverts C, and one combines them — three NAND gates, all from a single 74LS00.

The NOR-only form comes from the product of sums in the same way, or from the sum of products with an inverter on the end, which is why it often costs a gate or two more.

Questions

How do I convert an expression to NAND gates only?

Write it as a sum of products, complement it twice, and apply De Morgan's theorem to the inner complement. Each AND term becomes a NAND, and the OR that joined them becomes one more NAND. A single variable that was a term on its own needs an inverter, which is a NAND with one input.

Which form needs fewer gates?

It depends on the function. A sum of products usually converts to NAND with no extra gates beyond inverters, while NOR suits a product of sums. The converter counts the gates in each so you can compare.

Which chips do I need?

The 74LS00 holds four 2-input NAND gates and the 74LS02 holds four 2-input NOR gates. Terms with more inputs use the 74LS10 (three-input NAND), 74LS20 (four-input NAND) or 74LS27 (three-input NOR).

What does a bar over a single term mean in the result?

It is a NAND or NOR gate used as an inverter, with one input or with its inputs tied together.

More free logic calculators

When a calculator is not enough.

The Logic Gate Simulator keeps the expression, the truth table, the K-map and the circuit side by side, and saves your work.