Audited ·Last updated 31 Jul 2026·7 citations·Tier 1·0 uses

Truth Table Calculator

Build the truth table for any logic expression. Supports AND, OR, NOT, XOR, NAND, NOR, implies and iff, and says if it is a tautology or contradiction.

Truth Table Calculator

Variables are single letters. Operators: NOT (¬ ~ !), AND (∧ & &&), OR (∨ | ||), XOR (⊕), NAND, NOR, IMPLIES (-> →), IFF (<-> ↔). Constants TRUE and FALSE work. Up to 6 variables.
Verdict
Contingency — true in some rows and false in others
Tautology when the expression is true in every row, contradiction when it is false in every row, contingency otherwise. Decided on exact row counts — there is no threshold and no rounding anywhere on this page.
Variables
3
Rows in the table
8
Rows where it is true
5
Rows where it is false
3
Tautology
0
Contradiction
0
Columns, in order
P, Q, R
Read as
((P ∧ Q) ∨ ¬R)
Truth table
TTT→T, TTF→T, TFT→F, TFF→T, FTT→F, FTF→T, FFT→F, FFF→T
Rows that make it true
TTT, TTF, TFF, FTF, FFF

Background.

A truth table calculator takes a sentence of propositional logic and works out its value under every possible combination of true and false for the variables inside it. Type (P AND Q) OR NOT R and it produces all eight rows in one pass, counts that five of them come out true, and reports the verdict: this expression is a contingency, meaning it is neither always true nor always false. That three-way classification — tautology, contradiction, contingency — is the whole point of building the table, and it is the reason truth tables have survived unchanged since Emil Post and Ludwig Wittgenstein both published the method in 1921.

The mechanical part is simple enough to do by hand and tedious enough to get wrong. With n variables there are 2^n rows, because each variable independently takes one of two values. Two variables give four rows, three give eight, five give thirty-two, and six give sixty-four, which is where this calculator stops. Every row is then evaluated by working outwards from the innermost parentheses, applying one connective at a time. The arithmetic is trivial; the errors come from precedence, from mis-ordered rows, and from the implication connective, which behaves in a way that reliably surprises people the first several times they meet it.

That implication rule deserves saying plainly because it causes more confusion than the rest of the subject combined. P IMPLIES Q is false in exactly one row — the one where P is true and Q is false. Every other row, including both rows where P is false, comes out true. So 'if the moon is made of cheese then 2 + 2 = 5' is a true statement of propositional logic. Material implication is not causation and carries no claim that P has anything to do with Q; it only promises that you will never find a true antecedent sitting above a false consequent. Once that lands, the classical laws stop looking arbitrary: P IMPLIES Q turns out to be exactly the same table as NOT P OR Q, and the contrapositive NOT Q IMPLIES NOT P matches it row for row.

Precedence is the other place a calculator has to commit to something, and honesty requires saying that textbooks do not fully agree. This page fixes the ordering NOT, then AND and NAND, then OR, NOR and XOR, then IMPLIES, then IFF, with NOT and IMPLIES grouping to the right and everything else to the left. The first four levels are near-universal; where XOR, NAND and NOR sit is genuinely author-dependent, and no appeal to authority settles it. Rather than leave you guessing, the calculator prints your expression back fully parenthesised under 'Read as', so you can see precisely which grouping it used before you trust the table. If the echo is not what you meant, add parentheses — they always win.

Two conventions govern how to read the output. Variable columns are listed alphabetically rather than in order of appearance, so R AND P is tabulated with P on the left. Rows run from all-true down to all-false, with the rightmost variable alternating fastest, which is the ordering used in most discrete mathematics texts. Each row is printed as a pattern of T and F followed by the result, so TTF→T means the expression is true when the first two variables are true and the third is false.

Equivalence checking is the most common practical use and needs no special mode. To test whether two expressions are logically equivalent, join them with IFF and run the result: if the whole thing comes back a tautology, they have identical truth tables and are interchangeable. That single trick handles De Morgan's laws, distribution, exportation, double negation, and every homework question of the form 'show that these two statements are equivalent'. The same idea tests an argument for validity: join the conjunction of the premises to the conclusion with IMPLIES, and a tautology means the argument is valid.

The calculator accepts word operators and symbols interchangeably, so AND, ∧, & and && are all the same connective, as are ->, → and =>, and <->, ↔ and IFF. Input is case-insensitive, meaning p and P are the same variable. Multi-letter names are rejected rather than guessed at: PQ is an error, not shorthand for P AND Q, because silently inventing a conjunction would produce a confidently wrong table.

What is truth table calculator?

A truth table is an exhaustive listing of the truth value of a compound proposition under every possible assignment of truth values to its atomic variables. It is a decision procedure: because propositional logic has only finitely many assignments for finitely many variables, checking all 2^n rows settles definitively whether a formula is valid, unsatisfiable, or neither. A formula true in every row is a tautology, also called a logical truth or a valid formula. A formula false in every row is a contradiction, or unsatisfiable. A formula true in some rows and false in others is a contingency, and its truth then depends on facts rather than on logic alone. Emil Post's 1921 paper and Wittgenstein's Tractatus, published the same year, independently introduced the tabular method that is still used today.

How to use this calculator.

  1. Type your expression using single letters for variables — P, Q, R, and so on. Case does not matter.
  2. Use any spelling of the connectives you like: AND or ∧ or & or &&; OR or ∨ or |; NOT or ¬ or ~ or !; IMPLIES or -> or →; IFF or <-> or ↔. NAND, NOR and XOR are also supported.
  3. Check the 'Read as' line before you trust the table. It shows your expression fully parenthesised, so you can confirm the calculator grouped it the way you meant. Add parentheses if it did not.
  4. Read the verdict: tautology means true in every row, contradiction means false in every row, contingency means it depends on the variables.
  5. Read the table itself against the column order shown. Rows run from all-true to all-false, with the rightmost variable alternating fastest.
  6. To test whether two expressions are logically equivalent, join them with IFF and check whether the result is a tautology.
  7. To test whether an argument is valid, write (premise1 AND premise2) IMPLIES conclusion and check whether that is a tautology.

The formula.

rows = 2ⁿ · precedence: ¬ ≻ ∧,↑ ≻ ∨,↓,⊕ ≻ → ≻ ↔

Building a truth table is three steps: enumerate the assignments, evaluate the formula once per assignment, then classify the column of results.

Enumeration is where the 2^n comes from. Each of the n variables is independently true or false, so the multiplication principle gives 2 × 2 × … × 2 assignments, and each one is a row. This calculator lists them in the standard textbook order: the first row assigns true to everything, the last assigns false to everything, and the rightmost variable alternates on every row while the leftmost changes only once. Reading a row index as a binary numeral with 0 meaning true reproduces exactly that order, which is how the rows are generated internally.

Evaluation applies the connective definitions, which are fixed and not open to interpretation. NOT flips a value. AND is true only when both operands are true. OR is inclusive, so it is true unless both operands are false. XOR is true exactly when the two operands differ. NAND and NOR are the negations of AND and OR. IFF is true exactly when the two operands agree. IMPLIES is false in exactly one case — a true antecedent with a false consequent — and true in all three others, which is the rule that makes 'if false then anything' come out true.

Parsing has to resolve precedence before any of that can happen, and precedence is the one place where authors differ. This page applies NOT first, then AND and NAND, then OR, NOR and XOR, then IMPLIES, then IFF. NOT and IMPLIES associate to the right, so P -> Q -> R is read as P -> (Q -> R), while AND, OR, XOR, NAND, NOR and IFF associate to the left. The first four precedence levels are close to universal in the literature; the placement of XOR, NAND and NOR is genuinely author-dependent, and the calculator handles the ambiguity by echoing the grouping it used rather than by pretending there is a single right answer. Parentheses override everything and are always honoured.

Classification compares two exact integers. If the count of true rows equals the total row count, the formula is a tautology. If the count of true rows is zero, it is a contradiction. Anything strictly between is a contingency. No rounding occurs anywhere on this page and no tolerance is involved, so a formula that is false in exactly one row out of sixty-four is a contingency, not a near-tautology — the boundary is a single row wide on both sides and is tested there.

A formula with no variables at all, such as TRUE AND FALSE, still has one row, because 2^0 = 1. Its verdict is whichever of tautology or contradiction matches its single value, which is the mathematically correct answer rather than an edge case to be special-pleaded.

A worked example.

Example

Take the expression (P AND Q) OR NOT R. It uses three variables, so the table has 2^3 = 8 rows, and the columns are P, Q, R in alphabetical order. Work down the rows from all-true to all-false. With P, Q and R all true, P AND Q is true and NOT R is false, so the disjunction is true. With P and Q true and R false, P AND Q is still true and NOT R is now also true, so the result is true again. With P true, Q false and R true, P AND Q collapses to false and NOT R is false, so the whole thing is false — the first false row. With P true, Q false and R false, P AND Q is still false but NOT R is true, so the result is true. The bottom half is easier because P is false, which forces P AND Q to false in all four rows and leaves the answer entirely to NOT R. So the result is false when R is true and true when R is false: FTT is false, FTF is true, FFT is false, FFF is true. Collecting the column gives TTT→T, TTF→T, TFT→F, TFF→T, FTT→F, FTF→T, FFT→F, FFF→T. Five rows are true and three are false, so the verdict is a contingency: the expression is neither a logical law nor a logical impossibility, and whether it holds depends on the actual values of P, Q and R. The five satisfying assignments are TTT, TTF, TFF, FTF and FFF. Notice that every row with R false is satisfying, which the structure predicts — NOT R alone is enough to make the disjunction true — and that among the rows with R true, only the one where P and Q are both true survives. The 'Read as' line comes back as ((P ∧ Q) ∨ ¬R). That confirms the calculator applied NOT before OR, and used your parentheses around P AND Q rather than reassociating anything. Had you typed P AND Q OR NOT R with no parentheses at all, the precedence rules would have produced exactly the same grouping, because AND already binds tighter than OR.

expression(P AND Q) OR NOT R

Frequently asked questions.

How many rows does a truth table have?
2 raised to the number of distinct variables. One variable gives 2 rows, two give 4, three give 8, four give 16, five give 32 and six give 64. Each variable is independently true or false, so the row count doubles with every variable you add. This calculator supports up to six variables; beyond that a table stops being something a person can usefully read, and the algebraic methods of Boolean simplification are the better tool.
What is the difference between a tautology, a contradiction and a contingency?
A tautology is true in every row of its table — it is a logical law, true regardless of the facts. P OR NOT P is the classic example. A contradiction is false in every row; P AND NOT P is the classic example, and the negation of any contradiction is a tautology. A contingency is true in some rows and false in others, which means its truth depends on what the variables actually stand for. Most everyday statements are contingencies.
Why is 'P implies Q' true when P is false?
Because material implication only promises that you will never find a true antecedent above a false consequent. It is false in exactly one row — P true, Q false — and true in the other three. When P is false the promise cannot have been broken, so the implication holds vacuously. This is why 'if the moon is made of cheese then 2 + 2 = 5' counts as true in propositional logic. Material implication makes no claim about relevance or causation between P and Q, which is precisely the intuition that has to be set aside.
How do I check whether two expressions are logically equivalent?
Join them with IFF and run the combined expression. If the result is a tautology, the two have identical truth tables and are interchangeable in any context. For example (P IMPLIES Q) IFF (NOT P OR Q) comes back a tautology, which proves material implication can always be rewritten as a disjunction. The same technique verifies De Morgan's laws, distribution, exportation and double negation, and it is exactly what a homework question means by 'show these are equivalent'.
How do I use a truth table to check whether an argument is valid?
Write the conjunction of the premises, then IMPLIES, then the conclusion — for example (P IMPLIES Q) AND P IMPLIES Q for modus ponens — and check whether the whole formula is a tautology. If it is, there is no assignment that makes every premise true while the conclusion is false, which is exactly what validity means. If it is a contingency, the rows where it comes out false are the counterexamples that break the argument.
What operator precedence does this calculator use?
NOT binds tightest, then AND and NAND, then OR, NOR and XOR, then IMPLIES, then IFF. NOT and IMPLIES associate to the right, so P -> Q -> R reads as P -> (Q -> R); the others associate to the left. The first four levels are close to universal, but textbooks genuinely differ on where XOR, NAND and NOR belong, so rather than claim a single correct answer the calculator prints your expression back fully parenthesised under 'Read as'. Check that line, and add parentheses whenever you want to be certain.
In what order are the rows and columns listed?
Columns are alphabetical, not order of appearance, so R AND P is tabulated with P as the left-hand column. Rows run from all-true at the top to all-false at the bottom, with the rightmost variable alternating on every row and the leftmost changing only once. This is the ordering used in most discrete mathematics texts. Each row prints as a pattern of T and F followed by the result, so with columns P, Q, R the entry TFT→F means the expression is false when P is true, Q is false and R is true.
Can I use TRUE and FALSE as constants?
Yes. Spell them out — TRUE and FALSE — because single letters are always read as variables, so a bare T is the variable T rather than the constant true. An expression made only of constants, such as TRUE AND FALSE, has no variables and therefore exactly one row, since 2^0 = 1, and it is classified as a tautology or a contradiction according to that single value.
Why does the calculator reject PQ instead of reading it as P AND Q?
Because implicit conjunction is a notation some books use and others do not, and guessing would produce a confidently wrong table with no warning. Variables on this page are single letters, and any run of two or more letters must be one of the named operators — AND, OR, NOT, XOR, NAND, NOR, IMPLIES, IFF, TRUE, FALSE. Anything else raises an error naming the offending word and suggesting the explicit conjunction you probably meant.

References& sources.

  1. [1]Levin, Oscar. Discrete Mathematics: An Open Introduction, 3rd edition, §3.1 "Propositional Logic" — the implication table (T, F, T, T for the rows TT, TF, FT, FF), the definition of a tautology as "a statement which is true on the basis of its logical form alone", the biconditional test for logical equivalence, and the doubling row count (4 rows for two statements, 8 for three, 16 for four). Open access; retrieved 2026-07-29.
  2. [2]Stanford Encyclopedia of Philosophy, "Conditionals", §2.1 "Two Kinds of Truth Condition" — the material conditional: "'If A, B' is false when A is true and B is false. In all other cases, 'If A, B' is true", and its equivalence to ∼(A ∧ ∼B) and to ∼A or B. An independent, non-mathematical confirmation of the connective most often implemented backwards. Open access; retrieved 2026-07-29.
  3. [3]Weisstein, Eric W. "Truth Table." MathWorld — Wolfram Research. Defines a truth table as "a two-dimensional array with n+1 columns" whose "first n columns correspond to the possible values of n inputs, and the last column to the operation being performed", which is the layout this page reproduces in text. Retrieved 2026-07-29.
  4. [4]Post, Emil L. "Introduction to a General Theory of Elementary Propositions." American Journal of Mathematics 43, no. 3 (1921): 163–185 — the origin of the truth-table decision procedure and of the tautology/contradiction classification. Gated (JSTOR); cited bibliographically, not retrieved. No connective semantics on this page is taken from it.
  5. [5]Wittgenstein, Ludwig. Tractatus Logico-Philosophicus (1921), propositions 4.31 and 4.442 — the truth-table schema published independently of Post in the same year. Project Gutenberg carries the full C. K. Ogden translation; the catalogue record was verified, the full text was not machine-readable at fetch time, so this is a bibliographic citation.
  6. [6]Mendelson, Elliott. Introduction to Mathematical Logic, 6th edition. CRC Press, 2015, §1.2 "Truth Tables" — the standard connective semantics. Print reference, cited bibliographically; not retrieved during authoring. Every connective table this page implements is independently confirmed by the Levin and SEP entries above.
  7. [7]Enderton, Herbert B. A Mathematical Introduction to Logic, 2nd edition. Academic Press, 2001, §1.2 "Truth Assignments" — the formal definition of a truth assignment. Print reference, cited bibliographically; not retrieved during authoring.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 977 calculators remain free
  • No billing is enabled
Coming soon