# Logic Gates (NOT, Buffer, AND, OR, NAND, NOR, XOR, XNOR) and Their Truth Tables

Logic gates are the cornerstone of digital electronics, serving as the fundamental building blocks for a vast array of electronic devices and computing systems.

Each gate, characterized by a unique symbol, performs a specific logical function, dictating how binary inputs are processed to produce a binary output.

Understanding the symbols and truth tables of various logic gates, such as AND, OR, NOT, NAND, NOR, XOR, and XNOR, is crucial for anyone diving into the realms of circuit design and digital computation.

Published: January 22, 2024.

## What is a Logic Gate?

Logic gates perform basic logical functions that are essential for digital tasks.

A logic gate is a physical device or a theoretical construct that takes one or more binary inputs and produces a single binary output.

The output is determined based on a specific logical function defined by the type of gate.

Logic gates may have one, two, or more inputs, but the most common ones feature one or two inputs.

Logic gates are used in various digital circuits for different purposes, ranging from simple tasks like turning a light on and off to complex computations in a computer's CPU.

They are the building blocks of digital integrated circuits (ICs) and play a vital role in creating complex functionalities in computer systems, telecommunications, and control systems.

## Basic Logic Gates

There are several types of logic gates, each defined by the logical operation it performs. The primary ones include AND, OR, NOT, NAND (NOT AND), NOR (NOT OR), XOR (Exclusive OR), and XNOR (Exclusive NOR).

Also, buffer gates are sometimes used, but not as common as other logic gates.

These gates are used in various combinations to perform complex digital operations in computers, communication systems, and other electronic devices.

• The NOT Gate is a unary gate that inverts its input; outputting 1 if the input is 0 and vice versa.
• The Buffer Gate provides no logical operation but serves to amplify the input signal, ensuring a stronger output that is the same as its input.
• The AND Gate produces an output of 1 only if all its inputs are 1.
• The OR Gate gives an output of 1 if any of its inputs is 1.
• The NAND Gate operates as an AND gate followed by a NOT gate, outputting 1 unless all its inputs are 1.
• The NOR Gate works as an OR gate followed by a NOT gate, producing a 1 only when all its inputs are 0.
• The XOR Gate outputs 1 only if an odd number of its inputs are 1.
• The XNOR Gate produces a 1 only if all its inputs are the same.

The following table lists basic logic gates with their ANSI logic gate symbols, IEC logic gate symbols, and their truth tables.

Logic Gate ANSI Logic Gate Symbol IEC Logic Gate Symbol Truth Table
NOT
 Input Output A Q 0 1 1 0
Buffer
 Input Output A Q 0 0 1 1
AND
 Input Output A B Q 0 0 0 1 0 0 0 1 0 1 1 1
OR
 Input Output A B Q 0 0 0 1 0 1 0 1 1 1 1 1
NAND
 Input Output A B Q 0 0 1 1 0 1 0 1 1 1 1 0
NOR
 Input Output A B Q 0 0 1 1 0 0 0 1 0 1 1 0
XOR
 Input Output A B Q 0 0 0 1 0 1 0 1 1 1 1 0
XNOR
 Input Output A B Q 0 0 1 1 0 0 0 1 0 1 1 1

Note: ANSI logic gate symbols are also known as "American" or "Military." IEC logic gate symbols are also known as "European" or "Rectangular." DIN symbols are deprecated and are not shown in the table.

Understanding logic gates and their truth tables is fundamental for anyone venturing into digital electronics or computer science.

These basic components form the backbone of modern digital technology, enabling the creation and operation of sophisticated electronic systems that power the digital world.

## Logic Gates Truth Tables Comparison

Truth tables are crucial in understanding the functionality of logic gates.

A truth table lists all possible input combinations to a gate and the corresponding output for each combination. It serves as a comprehensive guide to the behavior of the gate under all possible input scenarios.

By studying the truth table of a logic gate, one can predict its output for any given input, which is of crucial importance in designing and troubleshooting digital circuits.

The following table lists the outputs of basic logic gates for comparison purposes.

 Inputs Logic Gate Outputs A B NOT(Input A) Buffer(Input A) AND OR NAND NOR XOR XNOR 0 0 1 0 0 0 1 1 0 1 1 0 0 1 0 1 1 0 1 0 0 1 1 0 0 1 1 0 1 0 1 1 0 1 1 1 0 0 0 1

Note: NOT and Buffer logic gates have only one input.

Although two different inputs can have sixteen possible outputs, these basic logic gates are by far the most common ones.

## NOT Gate | NOT Truth Table - Inverter Logic Gate

The NOT gate, also known as an inverter, is a fundamental digital logic gate that operates on a single binary input.

Its primary function is to invert the input signal: if the input is 1 (high or true), the output is 0 (low or false), and if the input is 0, the output is 1.

### NOT Gate Truth Table

 Input Output A Q 0 1 1 0

The NOT gate plays a crucial role in digital circuits, especially in creating more complex gates and operations, as it alters signal states, enabling various logical functionalities in computing and electronic systems.

In the world of integrated circuits (ICs), both the 7400 and 4000 series contain specific ICs that function as NOT gates or inverters.

### 7400 Series (TTL Logic):

• The 7404 IC is the standard inverter in the 7400 series. It contains six independent NOT gates.
• Additionally, the 7405 IC includes six open-collector inverters, which are similar to NOT gates but with an open-collector output allowing for voltage level shifting and wired-AND configurations.

### 4000 Series (CMOS Logic):

• In the 4000 series, the 4049 IC is a widely used inverter chip. It contains six inverters and is known for its high-input impedance characteristic of CMOS logic.
• Another option in the 4000 series is the 4069 IC, which also includes six independent inverters.

Both these series are popular in digital circuit design for different applications, with the 7400 series being TTL (Transistor-Transistor Logic) based, and the 4000 series being CMOS (Complementary Metal-Oxide-Semiconductor) based. The choice between them often depends on the specific requirements of the circuit, such as speed, power consumption, and voltage levels.

## Buffer Gate | Buffer Truth Table

A Buffer gate, in digital electronics, is a simple logic gate that essentially functions as a signal amplifier. It takes a single input and produces an output, which is an exact replica of the input signal.

The primary purpose of a Buffer gate is not to alter the logic state of the signal (like other logic gates do), but to strengthen the signal's power and integrity, especially when it has to travel long distances across a circuit.

This helps in preventing signal degradation and ensures that the signal remains strong and clear.

Buffer gates are symbolized similarly to NOT gates, but without the inversion circle, and are essential in complex circuit designs where maintaining signal strength is crucial.

### Buffer Gate Truth Table

 Input Output A Q 0 0 1 1

In the 7400 and 4000 series of integrated circuits (ICs), there are specific ICs that contain buffer gates or inverters:

### 7400 Series (TTL Logic) - Buffers/Inverters:

• The 7417 IC is a hex buffer with high-voltage open-collector outputs.
• The 7407 IC consists of six high-voltage open-collector buffer/drivers.
• Although not buffers per se, the 7404 and 7405 ICs, as mentioned previously, contain NOT gates (inverters), which can be used in buffer configurations.

### 4000 Series (CMOS Logic) - Buffers/Inverters:

• The 4049 IC is a hex inverting buffer with high-input impedance, a characteristic of CMOS technology.
• The 4050 IC is the non-inverting variant, featuring six buffer gates.
• Similar to the 7400 series, the 4069 IC includes six CMOS inverters that can be used in buffer configurations.

### Buffer Gate Using Double Inversion - Two NOT/Inverter Gates

Buffer gate can be created using two inverters (NOT gates) connected in series:

 A A Q=A 0 1 0 1 0 1

Using two inverters instead of a single buffer gate offers several advantages, including:

• Signal Restoration: Each inverter in the series can reinforce and reshape the signal, effectively acting as a regenerator. This is particularly useful in long-distance signal transmission, where signal integrity might degrade.
• Noise Margin Improvement: The cascading of NOT gates can enhance the noise margin of a circuit. Each inverter strengthens the signal, making it more resilient to noise and interference.
• Availability and Cost: NOT gates are more commonly available and may be less expensive than specialized buffer gates. Using two NOT gates can be a cost-effective solution, especially in large-scale or budget-conscious projects.
• Design Flexibility: Implementing two NOT gates provides greater flexibility in circuit design. Designers can easily insert additional logic between the two inverters if needed, without significantly altering the overall circuit layout.
• Delay Adjustment: The series connection of two NOT gates introduces a small delay, which can be advantageous in timing-sensitive applications. This delay can be used to align or synchronize signals in a circuit.
• Standardization and Simplicity: Using standard NOT gates can simplify the design and manufacturing process, as they are common components in digital logic. This standardization can also simplify troubleshooting and repair.
• Compatibility with Existing Designs: In many existing circuit designs, NOT gates are already in use for various purposes. Integrating two NOT gates in series can be more compatible with these existing designs, reducing the need for significant redesigns.

## AND Gate | AND Truth Table

The AND gate is a basic digital logic gate that implements logical conjunction. It is a binary gate, meaning it operates on two input signals.

The fundamental principle of the AND gate is straightforward: it outputs a high signal (1) only if both of its inputs are high (1). If either or both of the inputs are low (0), the output is low (0).

This behavior is summarized in its truth table, where the only combination of inputs that results in a high output is 1 AND 1.

### AND Gate Truth Table

 Input Output A B Q 0 0 0 1 0 0 0 1 0 1 1 1

In the 7400 and 4000 series of integrated circuits (ICs), several ICs contain AND gates:

### 7400 Series (TTL Logic) - AND Gates:

• 7408: This IC contains four independent 2-input AND gates.
• 7411: This IC comprises three 3-input AND gates.
• 7421: It features two 4-input AND gates.

### 4000 Series (CMOS Logic) - AND Gates:

• 4081: This IC contains four 2-input AND gates, similar to the 7408 but in CMOS logic.
• 4073: It has three 3-input AND gates.

## OR Gate | OR Truth Table

The OR gate is a fundamental digital logic gate that performs the logical disjunction operation. It is a binary gate, meaning it typically operates on two input signals.

The primary function of an OR gate is to output a high signal (1) if any one or both of its inputs are high (1). The gate only outputs a low signal (0) when both inputs are low (0).

This characteristic is encapsulated in its truth table, where the output is 1 for all input combinations, except when both inputs are 0.

### OR Gate Truth Table

 Input Output A B Q 0 0 0 1 0 1 0 1 1 1 1 1

OR gates are essential in digital circuits, especially in creating more complex logic circuits, such as adders or multiplexers, and are integral in implementing logical decision-making processes in computing and electronic systems.

In the 7400 and 4000 series of integrated circuits (ICs), there are specific ICs designed to contain OR gates:

### 7400 Series (TTL Logic) - OR Gates:

• 7432: This IC contains four independent 2-input OR gates.
• 7437: It has four 2-input NAND gates, which can be used alongside NOT gates to create OR gates.
• 7427: This IC comprises three 3-input NOR gates. Similar to NAND, these can be used with NOT gates to create OR functionality.
• 7430: It features an 8-input NAND gate, which, like the others, can be inverted to function as an OR gate.

### 4000 Series (CMOS Logic) - OR Gates:

• 4071: This IC contains four 2-input OR gates, analogous to the 7432 but using CMOS technology.
• 4072: It has two 4-input OR gates.
• 4075: This IC comprises three 3-input OR gates.
• 4001: It features four 2-input NOR gates, which can be inverted for OR functionality.

## NAND Gate | NAND Truth Table

The NAND gate is a fundamental digital logic gate that represents the negation of the AND operation.

It is a binary gate, meaning it operates on two input signals. The output of a NAND gate is the inverse of that of an AND gate.

It produces a high signal (1) unless both of its inputs are high (1), in which case it outputs a low signal (0).

In other words, the NAND gate outputs 0 only when all its inputs are 1. This behavior is clearly demonstrated in its truth table, where the only combination of inputs that results in a low output is 1 NAND 1.

### NAND Gate Truth Table

 Input Output A B Q 0 0 1 1 0 1 0 1 1 1 1 0

The NAND gate is especially significant in digital electronics because it is a "universal gate," meaning that any other basic gate (AND, OR, NOT, NOR, XOR, XNOR) can be constructed using only NAND gates.

This unique property makes it extremely versatile and crucial in the design and implementation of complex digital systems.

In the 7400 and 4000 series of integrated circuits (ICs), there are specific ICs that include NAND gates:

### 7400 Series (TTL Logic) - NAND Gates:

• 7400: This IC is perhaps the most famous in the series, containing four independent 2-input NAND gates.
• 7410: It contains three 3-input NAND gates.
• 7420: This IC features two 4-input NAND gates.
• 7430: It includes one 8-input NAND gate.

### 4000 Series (CMOS Logic) - NAND Gates:

• 4011: This IC contains four 2-input NAND gates, similar to the 7400 but using CMOS technology.
• 4023: It has three 3-input NAND gates.
• 4012: This IC features two 4-input NAND gates.
• 4068: It includes one 8-input NAND gate.

## NOR Gate | NOR Truth Table

The NOR gate is a key digital logic gate that performs the logical NOR (Not OR) operation. It is a binary gate, typically having two input signals. The NOR gate is essentially the inverse of the OR gate.

It outputs a high signal (1) only when both of its inputs are low (0). If either or both of the inputs are high (1), the output is low (0).

This characteristic makes the NOR gate a negated OR gate, as its truth table demonstrates: the output is 0 for all input combinations except when both inputs are 0.

### NOR Gate Truth Table

 Input Output A B Q 0 0 1 1 0 0 0 1 0 1 1 0

The NOR gate holds a special position in digital electronics, similar to the NAND gate, as it is also a "universal gate."

This means that any other basic gate (AND, OR, NOT, NAND, XOR, XNOR) can be constructed using only NOR gates.

Due to this property, NOR gates are highly valued in the design of digital circuits and systems, offering great flexibility and utility in various applications.

In the 7400 and 4000 series of integrated circuits (ICs), there are specific ICs that contain NOR gates:

### 7400 Series (TTL Logic) - NOR Gates:

• 7402: This IC contains four independent 2-input NOR gates.
• 7427: It has three 3-input NOR gates.
• 7425: This IC features two 4-input NOR gates with strobe inputs, although it's less common.

### 4000 Series (CMOS Logic) - NOR Gates:

• 4001: This IC contains four 2-input NOR gates.
• 4025: It has three 3-input NOR gates.
• 4002: This IC features two 4-input NOR gates.

## XOR Gate | XOR Truth Table

The XOR gate, short for "Exclusive OR" gate, is a crucial digital logic gate used in electronic circuits. It is a binary gate, which means it typically operates on two input signals.

The XOR gate outputs a high signal (1) if and only if the number of high inputs (1s) is odd. In simpler terms, it gives a high output when the inputs are different (one high and one low). If both inputs are the same (either both high or both low), the output is low (0).

This behavior is depicted in its truth table, where the output is 1 for input combinations of 0 XOR 1 and 1 XOR 0, but 0 for 0 XOR 0 and 1 XOR 1.

### XOR Gate Truth Table

 Input Output A B Q 0 0 0 1 0 1 0 1 1 1 1 0

The XOR gate is particularly significant in digital electronics and computing for its role in arithmetic operations, like addition and subtraction, and in logical operations where difference detection is required.

It is also a fundamental component in more complex digital systems, such as parity checking and bitwise addition (without carry), in certain types of encoders and decoders, for error detection and correction algorithms, etc.

In the 7400 and 4000 series of integrated circuits (ICs), specific ICs are designed to include XOR (Exclusive OR) gates:

### 7400 Series (TTL Logic) - XOR Gates:

• 7486: This IC is the standard representation for XOR gates in the 7400 series. It contains four independent 2-input XOR gates.

### 4000 Series (CMOS Logic) - XOR Gates:

• 4070: This IC contains four 2-input XOR gates, similar to the 7486 but using CMOS technology.
• 4030: It is another variant with four 2-input XOR gates, practically equivalent to the 4070.

## XNOR Gate | XNOR Truth Table

The XNOR gate, also known as the "Exclusive NOR" gate, is an important digital logic gate that is essentially the complement of the XOR (Exclusive OR) gate.

It is typically a binary gate, operating on two input signals. The XNOR gate outputs a high signal (1) if and only if both of its inputs are equal.

This means it gives a high output when both inputs are either high (1) or low (0). Conversely, the output is low (0) when the inputs are different (one high and one low).

In its truth table, the XNOR gate produces an output of 1 for the input combinations of 0 XNOR 0 and 1 XNOR 1, but an output of 0 for 0 XNOR 1 and 1 XNOR 0.

### XNOR Gate Truth Table

 Input Output A B Q 0 0 1 1 0 0 0 1 0 1 1 1

The XNOR gate plays a vital role in digital electronics and computing, particularly in circuits requiring equality or parity checking.

It is used in digital systems where the detection of identical or complementary signals is necessary, such as in certain types of error detection and correction schemes and in data storage and transmission systems.

In the 7400 and 4000 series of integrated circuits (ICs), specific ICs are designed to include XNOR (Exclusive NOR) gates:

### 7400 Series (TTL Logic) - XNOR Gates:

• 74266: This IC contains four 2-input open collector XNOR gates.

### 4000 Series (CMOS Logic) - XNOR Gates:

• 4077: This IC contains four 2-input XNOR gates.

## Few Final Words

Logic gates are the fundamental building blocks of digital electronics, each characterized by its unique symbol and defined by a specific truth table that outlines its operation.

Understanding these gates - AND, OR, NOT, NAND, NOR, XOR, and XNOR - is essential for grasping the basics of digital circuit design and computation. The versatility and functionality of these gates enable complex operations in modern computing and electronic systems, demonstrating their important role in the advancement of technology.

Their study not only provides insight into the world of digital logic but also lays the groundwork for innovation and development in the ever-evolving field of electronics and computer science.