PublicSoftTools

Truth Table Generator

Enter any propositional logic expression and get the complete truth table instantly. Supports AND, OR, NOT, implication, biconditional, and XOR with up to 5 variables. Detects tautologies and contradictions. No signup, runs entirely in your browser.

Operators: AND, OR, NOT, -> (implies), <-> (iff), XOR. Use p, q, r, s, t for variables.
True rows: 1 / 4
pqp AND q
FFF
FTF
TFF
TTT

How to Use the Truth Table Generator

  1. 1Type a logic expression using symbols (∧, ∨, ¬, →, ↔) or words (AND, OR, NOT, IMPLIES, IFF, XOR).
  2. 2Use up to 5 variables (p, q, r, s, t) and parentheses to group sub-expressions.
  3. 3Read the complete truth table — every combination of inputs and the resulting value.
  4. 4Check the verdict: an all-true column is a tautology, an all-false column a contradiction.

Worked Example: Proving De Morgan's Law

Enter NOT (p AND q). With two variables the table has 2² = 4 rows. The expression is false only in the single row where both p and q are true; in the other three rows it is true. Now enter (NOT p) OR (NOT q) in a fresh table and compare: the two output columns are identical, row for row. That equivalence is De Morgan's first law — negating an AND turns it into an OR of the negations.

Truth tables turn “is this always true?” into something you can just look at. Try (p IMPLIES q) IFF (NOT p OR q): every row comes out true, so the generator flags it as a tautology — a formal proof that “if p then q” is the same as “not-p or q”, which is exactly the rewrite compilers and circuit designers use to simplify conditionals. Because the table exhausts every input combination, a matching pair of columns is a complete proof, not just evidence.

Logic Tips

Verify De Morgan's laws

Enter NOT (p AND q) and compare it with (NOT p) OR (NOT q). Both should produce identical truth tables — that is De Morgan's first law. Try NOT (p OR q) vs (NOT p) AND (NOT q) for the second law.

Prove logical equivalence

Two expressions are logically equivalent if their truth tables are identical. Use the generator to verify that p → q is equivalent to NOT p OR q — a key simplification in circuit design.

Check tautologies

Tautologies are logically always-true statements. Enter (p → q) IFF (NOT p OR q) to verify this is a tautology. The generator will confirm it is true for all rows.

Operator precedence

The precedence order (highest to lowest) is: NOT, AND, OR, XOR, → (implies), ↔ (iff). Use parentheses to override precedence. (p AND q) OR r is different from p AND (q OR r).

Frequently Asked Questions

What operators are supported?

AND, OR, NOT, → (implies), ↔ or IFF (biconditional), and XOR. You can use symbols (∧, ∨, ¬, →, ↔) or words (AND, OR, NOT, IMPLIES, IFF, XOR). Parentheses are supported for grouping.

How many variables can I use?

Up to 5 variables (p, q, r, s, t). With 5 variables, the truth table has 32 rows (2⁵). More than 5 variables would produce tables too large to display usefully.

What is a tautology?

A tautology is a formula that is true for every possible combination of variable values. Example: p OR NOT p is always true. A contradiction is always false — p AND NOT p is never true.

How does implication (→) work?

p → q (p implies q) is false only when p is true and q is false. In all other cases it is true. This matches the logical definition of "if p then q" — the statement is only violated when the premise is true but the conclusion is false.

What is the difference between XOR and OR?

OR (inclusive or) is true when at least one operand is true, including when both are true. XOR (exclusive or) is true only when exactly one operand is true. XOR is false when both operands have the same value.

Is my data stored?

No. The parser and evaluator run entirely in your browser. No expressions or results are sent to any server.