Math
Truth Table Generator
Type a propositional logic expression such as (p → q) ∧ ¬q → ¬p and the truth table generator lists every combination of truth values for its variables, evaluates each subexpression in its own column, and reports whether the expression is a tautology, a contradiction, or a contingency.
Word operators (and, or, not, implies, iff, xor) and symbols are both accepted.
Variables are single letters. Operators: and/∧/&, or/∨/|, not/¬/~/!, ->/→ (implies), <->/↔ (iff), xor/⊕. Precedence: not, and, xor, or, implies, iff.
Try an example
Result
Final column
—
- Classification
- —
- True rows
- —
- False rows
- —
- Variables
- —
- Disjunctive normal form
- —
- Assignments that make it true
- —
Student quick launch
Grade planning, algebra checks, and formulas students reach for most.
Study path
Use this calculator with
Follow these when you want the formula behind the answer, a short lesson, or nearby tools in the same topic.
What the truth table generator solves
A truth table evaluates a compound statement for every possible combination of truth values of its variables. With n variables there are 2^n rows. Building the table column by column, from the innermost operation outward, is how you prove logical equivalences and check whether an argument form is valid.
| p | q | ¬p | p ∧ q | p ∨ q | p → q | p ↔ q | p ⊕ q |
|---|---|---|---|---|---|---|---|
| T | T | F | T | T | T | T | F |
| T | F | F | F | T | F | F | T |
| F | T | T | F | T | T | F | T |
| F | F | T | F | F | T | T | F |
Operator precedence
Without parentheses the calculator applies ¬ first, then ∧, then ⊕, then ∨, then →, then ↔. So p ∨ q → r means (p ∨ q) → r, and ¬p ∧ q means (¬p) ∧ q. Implication groups to the right: p → q → r is p → (q → r). Add parentheses whenever you are unsure.
How to use it
- Type the expression with single-letter variables and any of the accepted operator spellings.
- Pick T/F or 1/0 display.
- Read the table: variables on the left, one column per subexpression, the whole expression on the right. The classification and the true-row list are below it.
How to read the answer
A tautology has T in every row of the final column (a law of logic, such as p ∨ ¬p). A contradiction has F everywhere (such as p ∧ ¬p). Anything else is a contingency. The disjunctive normal form rebuilds the expression as an OR of the rows where it is true.
Common mistakes and edge cases
- Reading p → q as 'p and q': the implication is true whenever p is false, regardless of q.
- Forgetting parentheses: ¬p ∨ q is (¬p) ∨ q, not ¬(p ∨ q).
- Listing the rows in a different order and misreading the final column. This table uses T…T first, changing the last variable fastest.
- Using more than four variables: 32 or more rows are impractical to read; split the expression instead.
Worked examples
Hypothetical syllogism (tautology)
((p → q) ∧ (q → r)) → (p → r) is always true
Final column
T T T T T T T T
Implication
p → q is false only in the T, F row
Final column
T F T T
Contradiction
p ∧ ¬p is never true
Final column
F F
De Morgan's law as an equivalence
¬(p ∧ q) ↔ (¬p ∨ ¬q) is a tautology
Final column
1 1 1 1
Exclusive or with three variables
p ⊕ q ⊕ r is true when an odd number of inputs are true
Final column
1 0 0 1 0 1 1 0
Too many variables
Five variables are rejected
Final column
—
Frequently asked questions
How many rows does a truth table have?+
2^n rows for n variables: 2 for one variable, 4 for two, 8 for three, 16 for four.
Why is p → q true when p is false?+
An implication only promises something when its hypothesis holds. If p never happens, the promise is not broken, so the statement is counted as true (vacuously true).
What is a tautology?+
An expression that is true in every row of its truth table, such as p ∨ ¬p or (p → q) ↔ (¬p ∨ q). Tautologies are the laws of propositional logic.
How do I check that two statements are logically equivalent?+
Join them with ↔ and generate the table. If the result is a tautology, the two statements always have the same truth value.
What symbols can I type?+
and/∧/&/&&, or/∨/|/||, not/¬/~/!, implies/->/=>/→, iff/<->/<=>/↔, xor/⊕. Parentheses group; T and F (or 1 and 0) are constants.
In what order are the rows listed?+
All-true first, with the rightmost variable changing fastest: TT, TF, FT, FF for two variables. This is the usual textbook order.
About this calculator
- Written by
- mathcheck editorial team
- Last reviewed
- September 4, 2026
Method
- Uses the values entered by the user and stable formulas documented on the page.
References
- OpenStax, Contemporary Mathematics, Section 2.4 “Truth Tables” — Building truth tables for compound statements.
- OpenStax, Contemporary Mathematics, Section 2.5 “Equivalent Statements”
Related calculators
Power Set Calculator
List every subset of a set with up to 6 elements, grouped by size, and count them with 2^n. Shows the C(n, k) count for each size, the number of proper subsets, and includes the empty set and the set itself.
Union and Intersection Calculator
Find the union A ∪ B, intersection A ∩ B, differences A − B and B − A, and symmetric difference of two sets, with Venn-diagram region counts and the inclusion–exclusion check |A ∪ B| = |A| + |B| − |A ∩ B|.
Binary Calculator
Add, subtract, multiply, or divide binary numbers with the column method shown: carries, borrows, partial products, and a long-division tableau, plus decimal, hex, and octal equivalents.
Subset Calculator
Check whether one set is a subset, proper subset, or superset of another, or whether the two sets are equal. Lists the elements that break the relation, the common elements, and the number of subsets each set has.
Bitwise Calculator
AND, OR, XOR, NOT, NAND, and NOR on binary, decimal, octal, or hex inputs at 4 to 64 bits, with an aligned bit grid, a bit-by-bit truth table, and the result in every base.
Completing the Square Calculator
Complete the square on ax^2 + bx + c step by step: every algebraic line shown, exact fractions, vertex form a(x - h)^2 + k, the vertex, and the roots as simplified radicals.
Last updated: September 4, 2026