NAND Logic Gate Simulator – Free

This NAND gate simulator evaluates a two-input NAND for the values you pick. The output is 0 only when both inputs are 1, and 1 in every other case.

How to use the NAND Gate Simulator tool

  1. Choose 1 or 0 in the Input A list.
  2. Choose 0 or 1 in the Input B list.
  3. Select Calculate to evaluate A NAND B.
  4. Read the single output bit in the Result box, then change an input and calculate again to walk through the truth table.
  5. Select Copy to copy the output, or Clear to return both inputs to their defaults.

NAND gate truth table

NAND means NOT AND. The gate first ANDs its inputs, then inverts the answer. With two inputs there are four cases, and three of them produce 1.

When the page loads, Input A is 1 and Input B is 0, so selecting Calculate straight away returns 1. Set both inputs to 1 to see the only case that outputs 0.

A  B  A NAND B
0  0     1
0  1     1
1  0     1
1  1     0

Why NAND is called a universal gate

Any Boolean function can be built from NAND gates alone. That property, called functional completeness, is why early logic families and many chip designs standardized on it.

You can verify each identity below with the simulator by evaluating the inner gates first and feeding their outputs back in as inputs.

  • NOT A is A NAND A: tie both inputs together.
  • A AND B is a NAND followed by a NAND wired as an inverter.
  • A OR B is (A NAND A) NAND (B NAND B), which follows from De Morgan's law.
  • XOR takes four NAND gates, and a basic SR latch takes two cross-coupled ones.

How the NAND gate simulator computes the output

The tool reads each input as a one-bit number, applies a bitwise AND, inverts the result and keeps the lowest bit. In Boolean algebra that is NOT (A AND B), which De Morgan's law rewrites as (NOT A) OR (NOT B).

The inputs are limited to single bits by the two lists. To NAND whole binary words such as 1100 and 1010, use the Bitwise NAND Calculator, which applies the same rule to each bit position.

NAND gates in hardware

In CMOS a two-input NAND needs four transistors: two PMOS devices in parallel pulling the output high and two NMOS devices in series pulling it low. The classic 7400 chip packs four such gates into one package. NAND flash memory takes its name from the same structure, because its cells are wired in series like the pull-down side of a NAND gate.

Frequently asked questions

When does a NAND gate output 0?

Only when every input is 1. For a two-input gate that is the single row A = 1, B = 1. If either input is 0, the output is 1.

How is NAND different from AND?

The outputs are exact opposites. AND gives 1 only for the input pair 1 and 1. NAND gives 0 for that pair and 1 for the other three. A NAND gate is an AND gate with an inverter on its output.

How do I make a NOT gate from a NAND gate?

Connect the same signal to both inputs. With A on both pins the gate computes NOT (A AND A), which is NOT A. In the simulator, set Input A and Input B to the same value and the result is always its inverse.

Can this simulator handle three or more inputs?

No. It models one two-input gate. For a three-input NAND, apply the rule by hand: the output is 0 only if all three inputs are 1, and 1 otherwise.

What symbol is used for a NAND gate?

Schematics draw it as the D-shaped AND symbol with a small circle, called a bubble, on the output. In text you will see NOT (A AND B), an overbar across AB, or the Sheffer stroke, a vertical bar or up arrow between the operands.

Related tools