# Logic Gates

Digital circuits use Boolean logic to perform operations. Everything is in either one of two states: 1 (true) or 0 (false). Depending on your hardware, 1 usually corresponds to a high voltage and 0 corresponds to a low voltage.

## AND Gate

The symbol for the AND gate:

Pins 1 and 2 are inputs, and pin 3 is the output.

The AND gate will will output 1 if both inputs are also 1.

Truth Table for AND Gate
Inputs Output
0 0 0
0 1 0
1 0 0
1 1 1

## OR Gate

Symbol for the OR gate:

The OR gate will output 1 if any one or both of its inputs are 1.

Truth Table for OR Gate
Inputs Output
0 0 0
0 1 1
1 0 1
1 1 1

## Inverter (NOT) Gate

Symbol for the inverter:

This is a NOT gate, but in digital circuits it is usually called an inverter.

The OR gate will output 1 if its single input is 0.

Truth Table for OR Gate
Input Output
0 1
1 0

## NAND Gate

The symbol for the NAND gate:

The NAND gate is simply an AND gate with an inverter at the output. Notice the "bubble" at the output node of the symbol; this bubble indicates an inverted output.

Truth Table for NAND Gate
Inputs Output
0 0 1
0 1 1
1 0 1
1 1 0

## NOR Gate

Symbol for the NOR gate:

Similarly, the NOR gate is just an inverted OR gate. t will output 1 if neither of its inputs are 1.

Truth Table for NOR Gate
Inputs Output
0 0 1
0 1 0
1 0 0
1 1 0

## XOR

Symbol for the XOR gate:

The XOR (Exclusive OR) gate will output 1 if either of its inputs are 1, but not if both of its inputs are 1.

Truth Table for NOR Gate
Inputs Output
0 0 0
0 1 1
1 0 1
1 1 0

## XNOR

Symbol for the XNOR gate':

The XNOR gate is an inverted NOT gate; it will output 1 if neither of its inputs are 1, or if both of its inputs are 1.

Truth Table for XNOR Gate
Inputs Output
0 0 1
0 1 0
1 0 0
1 1 1