Logic gate truth tables
A logic gate truth table lists the output for every input combination. AND gives 1 only when both inputs are 1, OR gives 1 when at least one is 1, NOT flips its input, NAND and NOR are AND and OR followed by NOT, and XOR gives 1 when the inputs differ.
Two-input gates
Each row is one combination of the inputs A and B; each column is the output of one gate.
| A | B | AND | OR | NAND | NOR | XOR |
|---|
| 0 | 0 | 0 | 0 | 1 | 1 | 0 |
|---|
| 0 | 1 | 0 | 1 | 1 | 0 | 1 |
|---|
| 1 | 0 | 0 | 1 | 1 | 0 | 1 |
|---|
| 1 | 1 | 1 | 1 | 0 | 0 | 0 |
|---|
Gate expressions and rules
| Gate | Boolean expression | Rule |
|---|
| AND | A·B | AND gives 1 only when both inputs are 1 |
|---|
| OR | A + B | OR gives 1 when at least one input is 1 |
|---|
| NAND | (A·B)′ | NAND is AND followed by NOT: it gives 0 only when both inputs are 1 |
|---|
| NOR | (A + B)′ | NOR is OR followed by NOT: it gives 1 only when both inputs are 0 |
|---|
| XOR | A ⊕ B | XOR gives 1 when the inputs are different |
|---|
| NOT | A′ | NOT flips its input: 1 becomes 0 and 0 becomes 1 |
|---|