Calculator

Truth table generator

Type a propositional formula and get every row of its truth table, with the classification spelled out.

  • No account needed
  • Nothing leaves your browser
  • Works offline

What is in here

7topics
534problems
54formulas
60proof tasks
0 learned0 saved0 practice attempts0% accuracy0 proof checks

Calculators

Discrete math tools

Six calculators that run entirely in this browser. Inputs are validated, so a rejected entry says what is wrong instead of returning a confident wrong answer.

Logic

Truth table builder

Enumerate every assignment of a proposition and classify it as a tautology, a contradiction, or a contingency.

Variables like p, q, r with ! && || -> <-> xor and parentheses. Words work too: not, and, or, iff. Up to 6 variables.

Try
Tautology4 of 4 rows true · 2 variables
Truth table for (p -> q) <-> (!q -> !p): one row per combination of truth values, with the resulting value of the expression.
pqresult
FFT
FTT
TFT
TTT
Show as

About the truth table generator

A truth table lists every possible assignment of true and false to the variables in a propositional formula, and the value the formula takes for each one. With n variables the table has 2^n rows, which is why the generator caps the number of variables: past that point the table stops being something a person reads.

Write connectives however your course writes them. Negation accepts not, ! and ~; conjunction accepts and, && and &; disjunction accepts or, || and |; implication accepts -> and =>; the biconditional accepts <-> and <=>. Variables are single letters such as p, q and r, and parentheses group as you would expect.

Once the table is built the classification line tells you which of the three kinds of formula you have. A tautology is true in every row, a contradiction is false in every row, and a contingency is true in some rows and false in others. Two formulas are logically equivalent when their columns match row for row, so you can settle an equivalence question by generating both tables and comparing the last column.

Worked example

Worked example: contrapositive equivalence

Input(p -> q) <-> (!q -> !p)
ResultTrue in all 4 rows. Classification: Tautology.

Because the biconditional is a tautology, p -> q and its contrapositive are logically equivalent.

Questions

Frequently asked

How many rows does a truth table have?

Two to the power of the number of distinct variables. One variable gives 2 rows, two variables give 4, three give 8, and five give 32. Each row is one assignment of true and false to the variables.

What symbols can I type for the logical connectives?

Negation accepts not, ! or ~. Conjunction accepts and, && or &. Disjunction accepts or, || or |. Implication accepts -> or =>. The biconditional accepts <-> or <=>. You do not need to type unicode symbols.

How do I tell whether two formulas are logically equivalent?

Generate the truth table for the biconditional joining them. If the result is classified as a tautology, the two formulas are logically equivalent, because they take the same value in every row.