LogicGates.org Open the simulatorSimulator

AND gate

High only when every input is high.

AND gate truth table

ab Q
0 0 0
0 1 0
1 0 0
1 1 1

At a glance

Boolean expression
a ∧ b
Engineering notation
a · b
Inputs
Two or more
Output is high when
every input is high

AND gate symbol

ANSI distinctive shape
&
IEC rectangular symbol

The ANSI symbol is a D shape: a flat back where the inputs enter and a round front leading to the output. The IEC symbol is a rectangle labelled &, the ampersand for "and". Neither has a bubble on the output, since nothing is inverted. The logic gate symbols page draws all seven gates side by side in both standards.

How the AND gate works

An AND gate outputs 1 when all of its inputs are 1, and 0 the moment any one of them drops to 0. With two inputs that is a single 1 in the truth table, out of four rows.

Think of two switches wired in series along the same wire. The current only reaches the end if both switches are closed; opening either one breaks the circuit. That is exactly an AND gate, which is why AND is sometimes called a series connection.

3-input AND gate truth table

A 3-input AND gate outputs 1 only when all three inputs are 1, which is one row out of eight. AND is associative, so two 2-input AND gates in a chain give exactly the same table, and a wide AND can be built either way.

abc Inputs at 1 Q
000 0 0
001 1 0
010 1 0
011 2 0
100 1 0
101 2 0
110 2 0
111 3 1

Two 2-input AND gates in a chain, (a & b) & c, give exactly this table.

AND compared with the other gates

The same four input rows through every gate, with the AND column highlighted. NOT has only one input, so its column is NOT a and ignores b.

a b AND OR NAND NOR XOR XNOR NOT a
00 0 0 1 1 0 1 1
01 0 1 1 0 1 0 1
10 0 1 1 0 1 0 0
11 1 1 0 0 0 1 0
  • AND and OR agree when the two inputs are equal, and disagree on 01 and 10, where AND gives 0 and OR gives 1.
  • NAND is the exact opposite of AND on every row.

Building the AND gate from other gates

Each of these is equivalent to the AND gate. Paste any of them into the simulator with ctrl+E to see the circuit.

Construction Expression Equals
From NAND gates !(!(a & b) & !(a & b)) a & b
From NOR gates !(!(a | a) | !(b | b)) a & b
De Morgan form !(!a | !b) a & b

AND gate transistor circuit

In static CMOS, the textbook AND gate is a handful of transistors. Toggle the inputs to see which ones switch on and which network connects the output to the supply or to ground.

Y = 0 6 transistors
NANDVDDababGNDNOTVDDGNDY

NAND: the pull-up network conducts (the PMOS transistors driven by a and b are on) and the pull-down network is open, so the NAND output is connected to VDD and is 1.

NOT: the pull-down network conducts (the NMOS driven by the NAND output is on) and the pull-up network is open, so Y is connected to GND and is 0.

A single CMOS stage always inverts, so AND is built as NAND followed by an inverter: 4 transistors plus 2. PMOS transistors, drawn with a bubble on the gate, conduct when their gate is 0; NMOS conduct when it is 1.

AND gate chip: the 7408 pinout

To build with real parts, the AND gate comes four to a package in the 7400 series. The 7408 is a quad 2-input AND gate.

7408, 74HC08, 74LS08: quad 2-input AND gate, 14-pin DIP

11A21B31Y42A52B62Y7GND83Y93A103B114Y124A134B14VCC7408
7408 pin functions
Pin Name Function
1 1A Input A of gate 1
2 1B Input B of gate 1
3 1Y Output of gate 1
4 2A Input A of gate 2
5 2B Input B of gate 2
6 2Y Output of gate 2
7 GND Ground, 0 V
8 3Y Output of gate 3
9 3A Input A of gate 3
10 3B Input B of gate 3
11 4Y Output of gate 4
12 4A Input A of gate 4
13 4B Input B of gate 4
14 VCC Positive supply
  • 74HC: CMOS, 2 V to 6 V supply.
  • 74LS: bipolar TTL (low-power Schottky), 5 V supply.

AND gate examples

Everyday and engineering things that follow the AND rule.

  • A two-hand control on a machine press only runs the press while both buttons are held, so neither hand can be near the tool. The safety standards add a timing rule, but the core of it works like an AND gate.
  • A safe deposit box that needs both the bank's key and the customer's key opens only when both are turned: an AND of the two keys.
  • Many cars with a push-button start only start the engine when the button is pressed and the brake pedal is held down.
  • A washing machine starts its cycle only when the door is shut and the start button is pressed.

Where the AND gate is used

  • Gating a signal: feed data into one input and an enable line into the other, and the data only passes while enable is high.
  • Masking bits, which is what a bitwise AND does in software, one AND gate per bit.
  • Detecting that several conditions hold at once, such as "counter is at maximum" fed from every bit of the counter.
  • The carry output of a half adder is a single AND gate.

AND gate reference card

The symbol in both standards and the truth table on one image, for notes or a slide.

AND gate reference: ANSI and IEC symbols, the boolean expression a ∧ b, and the full truth table Click to download the AND reference card

In the simulator

The Logic menu has AND, and its input count is a parameter: open the node and ask for three or eight inputs instead of two rather than chaining several gates.

Open the simulator

Questions about the AND gate

What does an AND gate do?

It outputs 1 only when all of its inputs are 1. If any input is 0 the output is 0, so a 2-input AND gate is 1 on just one of its four rows, 11.

What is the symbol for an AND gate?

In the ANSI style it is a D shape, with a flat back for the inputs and a round front for the output. In the IEC style it is a rectangle labelled &.

Can an AND gate have more than two inputs?

Yes. An AND gate of any width outputs 1 only when every input is 1. In the simulator the input count is an option on the node, and in hardware three and four input AND gates are standard parts.

What is the difference between AND and NAND?

NAND is AND with the output inverted. Where AND gives 1 only when all inputs are 1, NAND gives 0 only in that case and 1 everywhere else.

What is an example of an AND gate in everyday life?

A two-hand control on a machine press, which only runs while both buttons are held, works like an AND gate. So does a safe deposit box that needs both the bank's key and the customer's key.

The other gates