What Is a Logic Gate? Read AND, OR, and XOR with Truth Tables
A logic gate applies Boolean rules to binary inputs and produces an output. Compare the truth tables for AND, OR, NAND, NOR, XOR, and XNOR, then see how a half adder uses them and why logical values are not fixed voltage levels.
What Is a Logic Gate? Read AND, OR, and XOR with Truth Tables
A logic gate is a circuit function that applies a Boolean operation to one or more 0/1 inputs and produces a 0/1 output. AND outputs 1 only when every input is 1; OR outputs 1 when at least one input is 1; XOR outputs 1 when its two inputs differ. Combining these functions lets us build arithmetic circuits such as a half adder.
0 and 1 are logical states
A truth table lists the output for every possible input combination. A two-input gate has four combinations. Here, 0 and 1 denote logical values. Physical circuits represent them with voltages, but the voltages interpreted as LOW or HIGH depend on the logic standard and component. The table below therefore describes relationships between logical values, not fixed voltages. Texas Instruments' Logic Guide shows that standards such as TTL and CMOS use different input and output voltage thresholds.
Truth tables for common gates
NOT has one input, so it has a separate table.
| A | NOT A (¬A) |
|---|---|
| 0 | 1 |
| 1 | 0 |
The two-input gates work as follows.
| A | B | AND (A ∧ B) | OR (A ∨ B) | NAND | NOR | XOR (A ⊕ B) | XNOR |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 |
AND is 1 only if both inputs are 1. OR is 1 if at least one is 1. NAND and NOR invert the outputs of AND and OR, respectively. XOR is 1 when the inputs differ; XNOR is 1 when they match. OR and XOR are easy to confuse: when A and B are both 1, OR outputs 1 while XOR outputs 0. With more than two XOR inputs, the output is 1 when an odd number of inputs are 1.
NAND gates alone can implement NOT, AND, and OR. A NAND A equals NOT A; inverting the output of a NAND gives AND; and, by De Morgan's law, NAND-combining NOT A with NOT B gives OR. This is why NAND is called a functionally complete gate.
Follow the logic in a half adder
A half adder is a combinational circuit that adds one-bit inputs A and B and outputs a sum and a carry. The sum is XOR because it is 1 when the bits differ; the carry is AND because it occurs only when both bits are 1.
| A | B | Sum A ⊕ B | Carry A ∧ B |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
The last row is 1 + 1 = binary 10. The current position gets 0 and the next position receives a carry of 1, so the sum output is 0 and the carry output is 1. A half adder does not accept a carry from a previous position; a full adder handles that extra input.
Separate the logical function from the physical circuit
A truth table defines a gate's logical function; it does not prescribe one transistor count or physical layout. Transistors are combined as switches to implement logic, and CMOS uses complementary nMOS and pMOS behavior. In chip design, a logical function can map to a standard-cell library cell or another circuit structure.
Gate count alone does not determine circuit delay. NIST describes a circuit as inputs, gates, and outputs connected by wires, and defines gate depth as the number of gates on the longest path from input to output. More serial stages can mean more logic steps for a signal to traverse, while real delay also depends on implementation and wiring. Use truth tables to read function, and consider both gate count and depth when comparing circuit structure.
Sources
[NIST: Circuit Complexity](https://csrc.nist.gov/Projects/circuit-complexity)
[Intel: The Transistor, Explained](https://www.intel.com/content/www/us/en/newsroom/tech101/the-transistor-explained.html)
[Texas Instruments: Logic Guide, Rev. AC (November 2025)](https://www.ti.com/lit/sg/sdyu001ac/sdyu001ac.pdf)