NAND Gate: A Complete Guide to Symbols, Truth Table & More

Logical Behavior of a NAND Gate

A NAND gate behaves as the opposite of an AND gate logically, and outputs \(\mathsf{0}\) when all inputs are \(\mathsf{1}\). In all other cases, the output is \(\mathsf{1}\). A NAND gate has a minimum of \(\mathsf{2}\) inputs and \(\mathsf{1}\) output signal.

  • A NAND Gate:
    • is the opposite of an AND gate.
    • Has \(\mathsf{2}\) or more inputs and \(\mathsf{1}\) output.

Representation of a NAND Gate

In this section, we will explore the symbolic and mathematical representations commonly associated with the gate. Additionally, we will examine how the gate is modeled using Verilog HDL.

Symbolic Representation

The symbolic representation of all the logic gates may vary depending on regional or institutional standards. In the United States, the American National Standards Institute (ANSI) and the Military Standard (MIL-STD-806B) standardized a symbol while European organizations such as the International Electrotechnical Commission (IEC), particularly in IEC 60617, favor a rectangular symbol. The Institute of Electrical and Electronics Engineers (IEEE), through standards like IEEE Std 91-1984, closely aligns with ANSI conventions and plays a pivotal role in harmonizing gate symbols across international platforms. Other countries and standards bodies may adopt slight variations to meet local engineering norms, but the underlying function always remains universally understood.

American Symbol

The NAND gate is commonly depicted as a curved-back figure, closely resembling the AND gate but set apart by a small circular marker at its output—indicating logical negation. On the left side, two or more input signals converge toward the gate’s sloped edge, representing the inclusive evaluation of input conditions.

this image shows the american symbol of the nand gate
American NAND Gate Symbol

European Symbol

In European engineering documentation, the NAND gate is represented as a rectangular block, maintaining uniformity across circuit schematics. Input lines enter from the left, feeding into the gate, while a single output line exits to the right, indicating the result of the logical operation. The output line has an angled line attached to it showing the negation of the AND gate.

this image shows the european symbol of the nand gate
European NAND Gate Symbol

IEEE Symbol

The gate’s visual representation aligns with the American ANSI style, most notably illustrated through the characteristic D-shaped symbol—now marked with a trailing circle at its output to denote logical negation. Similar to the AND symbol, it appears slightly elongated compared to its ANSI counterpart like all other IEEE symbols.

this image shows the ieee symbol of the nand gate
IEEE NAND Gate Symbol

Mathematical Representation

To represent the operation of a NAND gate mathematically, we start with the mathematical AND expression and apply negation to its result. While the AND operation is commonly denoted using the plus symbol (\(\mathsf{\cdot{}}\)), the NAND gate adds a layer of inversion. For example, the expression \(\mathsf{\overline{A\cdot{}B}}\) or \(\mathsf{(A\cdot{}B})’\)indicates that the output will be false only when both inputs, \(\mathsf{𝖠}\) and \(\mathsf{𝖡}\), are high (or true). If \(\mathsf{𝖠}\) and \(\mathsf{B}\) are input signals and the NAND gate produces the output signal \(\mathsf{OUT}\), it can be expressed as:

\[
\begin{aligned}
\mathsf{OUT\,}&\mathsf{= \overline{A\cdot{}B}= \overline{AB}}\textsf{ or } \\
\mathsf{OUT\,}&\mathsf{= (A\cdot{}B)’= (AB)’}
\end{aligned}
\]

If another input \(\mathsf{C}\) is added, then:

\[
\begin{aligned}
\mathsf{OUT\,}&\mathsf{= \overline{A\cdot{}B\cdot{}C}= \overline{A+B+C}}\textsf{ or } \\
\mathsf{OUT\,}&\mathsf{= (A\cdot{}B\cdot{}C)’= (ABC)’}
\end{aligned}
\]

Verilog HDL Representation

In Verilog HDL, the NAND gate combines the behavior of the AND operation with negation. At the dataflow and higher abstraction levels, it is typically written using the negation (~) of bitwise AND symbol (&) between the operands to get the result. At the gate level, the NAND gate is instantiated using the keyword nand(<output>, <inputs>). Given two input signals, A and B, the NAND gate produces an output signal OUT using the following logic (only the relevant code is shown).

assign OUT = ~(A & B); // dataflow coding
nand n1 (OUT, A, B); //gate-level coding

If another input \(\mathsf{C}\) is added, then:

assign OUT = ~(A & B & C); // dataflow coding
nand n2 (OUT, A, B, C); //gate-level coding

Truth Table of a NAND Gate

A truth table is a structured way to show the output of a logical operation or digital circuit for every possible combination of input values. It’s a staple tool in boolean algebra, digital electronics, and computer science, especially when designing or analyzing logic gates and circuits.

A truth table, typically has input columns to the left, and to the right are the derived or output expressions. Each row in a truth table represents a unque set of input combination.

Truth tables for 2-, 3-, and 4-input NAND gates are shown here.

Truth Table of a 2-Input NAND Gate

The following truth table demonstrates the behavior of a basic 2-input NAND gate, where the inputs are labeled \(\mathsf{A}\) and\(\mathsf{B}\), and the resulting output is represented as \(\mathsf{NAND}\). This gate yields a low output (\(\mathsf{0}\)) when all of the inputs are high; otherwise, the output remains high, (\(\mathsf{1}\)). The table captures every possible combination of inputs along with their corresponding output values. The truth table is presented after the NAND gate symbol that corresponds with the truth table.

the image shows a 2-input nand gate
the image shows the truth table of a 2-input nand gate

Truth Table of a 3-Input NAND Gate

The following truth table demonstrates the behavior of a basic 3-input NAND gate, where the inputs are labeled \(\mathsf{A}\), \(\mathsf{B}\) and \(\mathsf{C}\), and the resulting output is represented as \(\mathsf{AND}\). This gate yields a low output (\(\mathsf{0}\)) when all of the inputs are high; otherwise, the output remains high, (\(\mathsf{1}\)). The table captures every possible combination of inputs along with their corresponding output values. The truth table is presented after the NAND gate symbol that corresponds with the truth table.

the image shows a 3-input nand gate
the image shows the truth table of a 3-input nand gate

Truth Table of a 4-Input NAND Gate

The following truth table demonstrates the behavior of a basic 4-input AND gate, where the inputs are labeled \(\mathsf{A}\), \(\mathsf{B}\), \(\mathsf{C}\) and \(\mathsf{D}\), and the resulting output is represented as \(\mathsf{NAND}\). This gate yields a low output (\(\mathsf{0}\)) when all of the inputs are high; otherwise, the output remains high, (\(\mathsf{1}\)). The table captures every possible combination of inputs along with their corresponding output values. The truth table is presented after the NAND gate symbol that corresponds with the truth table.

the image shows a 4-input nand gate
the image shows the truth table of a 4-input nand gate

Can we Implement Multi-Input Gate Using 2-Input Gates in a Cascade?

A gate cascade refers to a structured arrangement where multiple logic gates are connected in series or in levels, so the output of one gate feeds into the input of another. This is especially common when you need to implement complex logic using simpler, typically 2-input gates — like building a 4-input AND using a cascade of 2-input AND gates. This changes the timings and other characteristics of the gate but our goal is to analyze if the logical behavior remains the same?

Implementing a 3-Input NAND Gate Using 2-Input NAND Gates

This circuit implements a 3-input NAND gate using cascaded 2-input NAND gates. Due to the non-associative nature of NAND logic, the behavior does not remain identical to a single 3-input gate, and input ordering does affect the final output. Readers are encouraged to construct truth tables for the configuration and compare the outputs to those of a canonical 3-input NAND gate. This verification demonstrates that implementing a multi-input NAND gate as a cascade of 2-input gates requires constructing a sequence of AND gates followed by a single NOT gate.

the image shows a 3-input nand gate
3-Input NAND Gate
the image shows an incorrect 2-level implementation of a 3-input nand gate using 2-input nand gates
Incorrect Alternative Implementation of a 3-Input NAND Gate using 2-Input NAND Gates in a 2-Level Cascade
the image shows a 3-level implementation of a 3-input nand gate using 2-input and gates and a not gate
Correct Alternative Implementation of a 3-Input NAND Gate using 2-Input AND Gates and a NOT Gate in a 3-Level Cascade

Implementing a 4-Input NAND Gate Using 2-Input NAND Gates

This illustration demonstrates a 4-input NAND gate constructed using cascaded 2-input NAND gates. Two implementations are provided: one with two levels of cascading, and another using three distinct levels of 2-input gates. Because NAND operations are non-associative, both versions produce logically different outputs. Readers are encouraged to generate truth tables based on each configuration and compare them against the canonical 4-input NAND gate to confirm different logical behavior. This verification demonstrates that implementing a multi-input NAND gate as a cascade of 2-input gates requires constructing a sequence of AND gates followed by a single NOT gate.

the image shows a 4-input nand gate
4-Input NAND Gate
the image shows an incorrect 2-level implementation of a 4-input nand gate using 2-input nand gates
Incorrect Alternative Implementation of a 4-Input NAND Gate using 2-Input NAND Gates in a 2-Level Cascade
the image shows a 3-level implementation of a 4-input nand gate using 2-input and gates and a not gate
Correct Alternative Implementation of a 4-Input NAND Gate using 2-Input AND Gates and a NOT Gate in a 3-Level Cascade
the image shows an incorrect 3-level implementation of a 4-input nand gate using 2-input nand gates
Incorrect Alternative Implementation of a 4-Input NAND Gate using 2-Input NAND Gates in a 3-Level Cascade
the image shows a 4-level implementation of a 4-input nand gate using 2-input and gates and a not gate
Correct Alternative Implementation of a 4-Input NAND Gate using 2-Input AND Gates and a NOT Gate in a 4-Level Cascade

Basic Quiz about NAND Gates