Computing Library › Classical Logic Gates
Classical Logic Gates

AND Gate

The AND gate outputs 1 only when all of its inputs are 1, implementing logical conjunction.

What it does

The AND gate implements logical conjunction. Its output is 1 only when every input is 1; if any input is 0, the output is 0. In words, all conditions must hold at once.

Truth table

Kronos motion — when
ABA AND B
000
010
100
111

Algebraic form

The AND operation is written as multiplication: A times B, often shown as AB or A and B. It obeys the identity A AND 1 = A and the annihilator A AND 0 = 0. It is commutative and associative, so inputs can be reordered or grouped freely.

How it is built

In CMOS an AND function is naturally a NAND followed by an inverter, because the pull-down network gives inversion for free. A standalone AND is therefore two stages, which is why NAND is often the cheaper primitive.

In code

python
out = a & b   # bitwise AND on 0/1 values
out = a and b  # logical AND on booleans

Where it appears

AND is one of the most common building blocks, and combined with OR and NOT it can express any Boolean function.