Skip to main content

Truth Tables Explained: AND, OR, NOT, XOR, IMPLIES, and IFF

Build truth tables for any logical expression. Covers AND, OR, NOT, XOR, NAND, NOR, IMPLIES, and IFF with step-by-step examples and tautology detection.

What Is a Truth Table?

A truth table is a systematic way to show all possible truth values of a logical expression. For each combination of true (T) and false (F) values for the variables, the table shows whether the entire expression evaluates to T or F. Truth tables are the foundation of propositional (Boolean) logic, used in mathematics, philosophy, computer science, and electrical engineering.

A logical expression with n variables has 2ⁿ rows. One variable: 2 rows. Two variables: 4 rows. Three variables: 8 rows. Four variables: 16 rows.

The Basic Connectives

AND (∧)

AND is true only when both inputs are true.

ABA AND B
FFF
FTF
TFF
TTT

OR (∨)

OR is true when at least one input is true.

ABA OR B
FFF
FTT
TFT
TTT

NOT (¬)

NOT flips the truth value.

ANOT A
FT
TF

XOR (⊕) — Exclusive OR

XOR is true when exactly one input is true (but not both).

ABA XOR B
FFF
FTT
TFT
TTF

Worked Example

Expression: A AND B

Variables: A, B — two variables → 4 rows

ABA AND B
FFF
FTF
TFF
TTT

Result: A AND B is true in 1 out of 4 rows — only when both A and B are true.

NAND and NOR

NAND (NOT AND) and NOR (NOT OR) are the negations of AND and OR. They are the foundation of digital circuit design — any logical circuit can be built from NAND gates alone (NAND universality), or from NOR gates alone.

ABA NAND BA NOR B
FFTT
FTTF
TFTF
TTFF

Material Implication (IMPLIES, →)

IMPLIES (A → B) models “if A then B.” It is false only when the premise A is true and the conclusion B is false.

ABA → B
FFT
FTT
TFF
TTT

The rows where A is false are called “vacuously true” — a false premise implies anything. This is the standard definition in classical logic, even though it differs from everyday causal language (“if it rains, the ground gets wet” does not imply that the ground stays dry when it is not raining).

Biconditional (IFF, ↔)

IFF (if and only if) is true when both sides have the same truth value.

ABA ↔ B
FFT
FTF
TFF
TTT

A ↔ B is equivalent to (A → B) AND (B → A).

Operator Precedence

When reading a complex expression without parentheses, operators bind in this order (highest to lowest):

  1. NOT (¬) — binds most tightly
  2. AND (∧), NAND
  3. XOR (⊕), NOR
  4. OR (∨)
  5. IMPLIES (→)
  6. IFF (↔) — binds most loosely

So A OR B AND C means A OR (B AND C), not (A OR B) AND C. Use parentheses to override precedence.

Tautologies and Contradictions

A tautology is a formula that is always true — every row in the Result column is T.

Classic tautology: A OR NOT A (law of excluded middle)

ANOT AA OR NOT A
FTT
TFT

A contradiction is a formula that is always false — every row is F.

Classic contradiction: A AND NOT A

ANOT AA AND NOT A
FTF
TFF

A formula that is neither a tautology nor a contradiction is satisfiable — it is true for at least one assignment but not all.

Building Truth Tables Step by Step

  1. List all variables (A, B, C, D — up to 4).
  2. Create 2ⁿ rows, cycling T and F so each combination appears exactly once.
  3. Evaluate sub-expressions from innermost parentheses outward.
  4. Compute the final column for the full expression.
  5. Check: if all F → contradiction; if all T → tautology; otherwise → satisfiable.

Tip: Always resolve NOT first (highest precedence), then AND/NAND, then XOR/NOR, then OR, then IMPLIES, then IFF.