🧮
🧮 Math & statistics

Truth Table Generator (AND, OR, NOT, XOR, implies, iff)

Results update as you type.

Your numbers

Understanding the truth table generator — concept and principle

This tool builds the truth table of a logical expression and tells you whether it is a tautology, a contradiction or neither. It lists every row, the result column, the number of true rows and which rows are true. Use it for logic and discrete mathematics courses, digital circuit design, programming conditions and checking arguments.

Truth table of hypothetical syllogism(p → q) ∧ (q → r) → (p → r)pqr=TTTTTTFTTFTTTFFTFTTTFTFTFFTTFFFTtautologytrue in 8 of 8 rows2³ = 8 rows for3 variableschaining implications always works
Every one of the 8 rows comes out true, so the statement is a tautology (hypothetical syllogism).

How it is calculated

A statement true in every row is a tautology; false in every row, a contradiction.

The principle

A compound statement's truth depends only on the truth of its parts. Listing every combination therefore covers every possible situation, and the multiplication principle says there are 2 × 2 × … = 2ⁿ combinations. Each row is evaluated from the inside out, like arithmetic. A tautology is a statement that is true by its logical form alone, whatever the facts. Two expressions are logically equivalent when their result columns match in every row.

Worked example

Default expression: (p → q) ∧ (q → r) → (p → r).

  1. Three variables give 2³ = 8 rows.
  2. Row T T T: p → q = T, q → r = T, p → r = T, so the whole is T.
  3. Row T F T: p → q = F, so the left side is F, and F → anything is T.
  4. Row T T F: q → r = F, the left side is F, so the result is T.
  5. Every row is true: TTTTTTTT, 8 of 8. Tautology — always true. This is the hypothetical syllogism (transitivity of implication).

How to read the result

A tautology is a valid rule of reasoning. A contradiction can never be true. Anything else is contingent: the true rows tell you exactly in which situations it holds. To check whether two expressions are equivalent, test A ↔ B; if it is a tautology, they are equivalent.

Common mistakes

Keep in mind: Different textbooks and programming languages use different symbols and precedence rules. Add brackets whenever there is any doubt.

Frequently asked questions

How many rows does a truth table with 4 variables have?

2⁴ = 16 rows.

Why is "if false, then anything" true?

The conditional only promises something when the premise is true, so it is not broken when the premise is false.

How do I show two statements are equivalent?

Their result columns must be identical in every row; equivalently, A ↔ B is a tautology.

Sources: OpenStax, Contemporary Mathematics (2023), §2.2 Compound Statements and §2.3 Constructing Truth Tables

Checked 9 Nov 2026. OpenStax, Contemporary Mathematics, §2.2 Compound Statements (connectives: negation, conjunction, disjunction, conditional, biconditional; dominance of connectives) and §2.3 Constructing Truth Tables (2ⁿ rows by the multiplication principle); exclusive or as defined in standard logic texts.

🧮 All math & statistics tools →🌍 Calculators by country →