AND
Inputs
| Pin | Type | Description |
|---|---|---|
| A | bit | First input signal |
| B | bit | Second input signal |
Outputs
| Pin | Type | Description |
|---|---|---|
| Q | bit | Result: 1 only when A=1 and B=1 |
How It Works
Imagine two switches wired in series on one line: the lamp lights up only when both are closed. The AND gate works exactly the same way. In everyday speech it is the word "and": "I will go for a walk if I finish my homework AND tidy my room" — failing one condition cancels the walk.
The key property of AND: the output is 1 only when both inputs are 1. Mathematically it is multiplication: 0×1=0, 1×1=1 — which is why AND is called logical multiplication. Example from arithmetic: in binary column addition 1+1 gives 10; XOR computes the sum bit 0, while AND produces the carry bit 1.
There is a second way to look at it: AND is a gatekeeper. A zero on any input guarantees a zero on the output, like a closed door in a corridor with two doors in a row. This is what makes masking possible: feed data into one input and a template of ones and zeros into the other, and only the bits you need survive.
Truth Table and Examples
| A | B | Q |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Example of an enable signal: you may start the car only if the key is turned (A=1) AND the seat belt is fastened (B=1) — every other combination means no. In an adder, AND computes the carry: 1+1=10₂, where the carry one is exactly the AND output at A=1 and B=1.
Usage
AND is unlocked at Level 3, but in practice it is needed everywhere. It is built from NAND and NOT (double negation), sits inside the half adder as the carry generator, and appears on every level where two conditions must hold at the same time. The bus version BusAND performs the same operation on all eight bits at once.
The classic application is bit masking. In the Harvard architecture an instruction fits in one byte: the high 4 bits are the opcode, the low 4 bits the operand. Applying the mask 00001111 through AND strips the opcode and leaves a clean operand. The same trick isolates status bits, flags and gamepad buttons.
Interactive Demo
Click inputs to toggle value (0 / 1)
Related components
Related articles
Frequently Asked Questions
Where is AND used?
For masking bits, enabling signals and checking conditions: the output is 1 only when every condition is met.
What happens if AND has more than two inputs?
The output is 1 only when all inputs are 1 — any single 0 forces the output to 0.
How do I build AND from NAND?
Feed the NAND output into a NOT gate: the double negation turns NAND back into AND. Two gates in total.
Why is AND called logical multiplication?
Its truth table matches the multiplication table exactly: 0×0=0, 0×1=0, 1×0=0, and only 1×1=1.