A truth table lists every possible combination of true and false values for the variables in a logical statement and shows the statement’s value in each case. It is the most direct way to check an argument, verify an identity such as De Morgan’s laws, or simplify a circuit. Type a formula in symbols or words; the generator builds the table with a column for each sub-expression, classifies the formula, tests it against a second formula for equivalence, and writes the canonical disjunctive and conjunctive normal forms.
How to use the truth table generator
- Type the expression. Symbols (¬ ∧ ∨ → ↔ ⊕), keyboard forms (! & | -> <-> ^) and words (NOT, AND, OR, IMPLIES, IFF, XOR, NAND, NOR) all work.
- Optionally type a second expression to test whether the two are logically equivalent.
- Choose T/F or 1/0 and whether rows start from all-true (common in logic courses) or all-false (common in digital electronics).
- Leave sub-expression columns on to see each step, or switch them off for a compact table.
Logical connectives
| Connective | Symbol | True when |
|---|---|---|
| Negation | ¬p | p is false |
| Conjunction (AND) | p ∧ q | both are true |
| Disjunction (OR) | p ∨ q | at least one is true |
| Exclusive or (XOR) | p ⊕ q | exactly one is true |
| Conditional | p → q | p is false or q is true |
| Biconditional | p ↔ q | both have the same value |
| NAND / NOR | p ↑ q, p ↓ q | negations of AND / OR |
With n variables the table has 2n rows; the generator handles up to 10 variables, or 1,024 rows.
Worked example
Is (p ∨ q) → ¬r equivalent to ¬(p ∨ q) ∨ ¬r?
- There are three variables, so 2³ = 8 rows.
- Work out p ∨ q and ¬r first, then the conditional. The first formula is false only when p ∨ q is true and ¬r is false, that is, when r is true and at least one of p, q is true: rows TTT, TFT and FTT.
- So it is a contingency, true in 5 of 8 rows, with minterms Σm(0, 1, 2, 4, 6) and maxterms ΠM(3, 5, 7).
- The second formula has the same column, row for row, so the two are logically equivalent: this is the rule p → q ≡ ¬p ∨ q applied with p ∨ q in place of p.
Change the comparison to the converse, comparing p → q with q → p, and the generator reports that they differ in two rows (p true and q false, or p false and q true): a conditional and its converse are not equivalent.
Using truth tables
Checking arguments
An argument is valid when the conjunction of its premises implies its conclusion in every row. Modus ponens, ((p → q) ∧ p) → q, comes out as a tautology; the fallacy of affirming the consequent, ((p → q) ∧ q) → p, does not.
Normal forms and circuits
Every row where the formula is true contributes a minterm, an AND of each variable or its negation. ORing the minterms gives the canonical DNF, which translates directly into a two-level AND-OR circuit. The canonical CNF does the same with the false rows. Both are shown when there are at most eight terms.
Sets and probability
The connectives mirror set operations: AND is intersection, OR is union, NOT is complement. The set operations calculator draws the matching Venn diagrams, and counting assignments relates to permutations with replacement, since 2n rows is the number of ways to assign two values to n variables.
Frequently asked questions
What symbols can I use?
NOT: ¬, !, ~ or a trailing prime (p′); AND: ∧, ^, &, &&, * or ·; OR: ∨, |, || or +; implies: →, -> or =>; if and only if: ↔, <-> or <=>; XOR: ⊕ or XOR; plus the words AND, OR, NOT, NAND, NOR, XOR, IMPLIES and IFF in any case. T, F, 1 and 0 are constants, and variables are letters such as p, q, r or A1.
What order are operators applied in?
NOT first, then AND (and NAND), XOR, OR (and NOR), implies and finally if-and-only-if. Implication groups to the right, so p → q → r means p → (q → r). When in doubt, add parentheses; the parsed form shown in the steps confirms how the calculator read your formula.
What are tautologies, contradictions and contingencies?
A tautology is true in every row, such as ((p → q) ∧ p) → q. A contradiction is false in every row, such as p ∧ ¬p. Anything else is a contingency: true for some assignments and false for others.
How do I check whether two statements are equivalent?
Enter the second statement in the comparison box. Two formulas are logically equivalent when they have the same truth value in every row, which is the same as saying their biconditional is a tautology. If they differ, the calculator lists rows where they disagree.
Why does p → q count as true when p is false?
The conditional only makes a promise about what happens when p is true. When p is false, the promise has not been broken, so the statement is treated as true (vacuously true). That convention makes p → q equivalent to ¬p ∨ q.