Truth Table Generator

Type a logical expression and get its full truth table step by step, with the tautology check, minterms and canonical sum of products.

Computed in your browser — nothing is sent

Generate a truth table for any logical expression — step by step

Variables: one letter (p, q, r… or A, B, C…). Operators: ¬ ~ ! NOT · ∧ ^ & AND · ∨ v | + OR · → -> · ↔ <-> · ⊕ XOR · ↑ NAND · ↓ NOR · A' (negation) · AB (implicit AND). ^ is read as AND (∧), as in logic textbooks; use ⊕ for XOR.

Examples:

How truth tables work

Quick answer: a truth table lists every combination of true and false for the variables in an expression, and the value the expression takes in each one. With n variables there are 2^n rows — 4 for p and q, 8 for p, q and r. Type an expression above with the symbol buttons or plain keys (~ for ¬, & or ^ for ∧, | or v for ∨, -> for →, <-> for ↔), and the table fills in column by column, one column per subexpression, the way it is done by hand.

Under the table it tells you whether the expression is a tautology (true in every row), a contradiction (false in every row) or a contingency. The circuits style shows 1 and 0 in counting order — 000, 001, 010… — plus the minterms and the canonical sum of products, the starting point for simplifying a logic circuit. Primes (A') and juxtaposition (AB for A AND B) work as in digital-logic textbooks, and the copy button pastes the table straight into Excel, Sheets or Word.

Truth tables of the basic connectives

pq¬pp ∧ qp ∨ qp → qp ↔ qp ⊕ q
TTFTTTTF
TFFFTFFT
FTTFTTFT
FFTFFTTF

Logic gate truth tables (AND, OR, NAND, NOR, XOR, XNOR)

ABANDORNANDNORXORXNOR
00001101
01011010
10011010
11110001

NAND and NOR are the complements of AND and OR, and each is universal on its own: every other gate can be built from NAND gates alone (or NOR gates alone). XOR is true when the inputs differ, which is why it is the sum bit of a half adder.

Common mistakes with truth tables

MistakeWhat goes wrongFix
Treating p → q as false when p is falseA conditional is only false in the row p = T, q = F.Check the p → q column above: three T, one F.
Ignoring precedence¬p ∧ q means (¬p) ∧ q, not ¬(p ∧ q); ∧ binds tighter than ∨, and → is weaker than both.Add parentheses whenever in doubt.
Reading ∨ as “one or the other, not both”The logical OR is inclusive: true when both are true.Use ⊕ (XOR) for the exclusive or.
Using ^ for XOR, as in programmingIn logic textbooks ^ is typed for ∧; this tool reads it as AND.Write ⊕ or XOR for exclusive or.

Reference tables

FAQ

How many rows does a truth table have?

2^n, where n is the number of variables: 2 variables give 4 rows, 3 give 8, 4 give 16. This generator handles up to 8 variables (256 rows).

What is the truth table of p → q?

It is false in exactly one row: p true and q false. In the other three rows it is true — including both rows where p is false, because a conditional with a false premise is true (vacuously).

What is the difference between a tautology and a contingency?

A tautology is true in every row (p ∨ ¬p), a contradiction is false in every row (p ∧ ¬p), and a contingency is true in some rows and false in others (p → q). A biconditional that is a tautology proves two expressions are equivalent.

Related tools