Truth Table Generator​

Enter a Boolean expression using AND, OR, NOT, XOR, IMPLIES, and IFF to generate its full truth table and see whether it's a tautology, contradiction, or contingency.

Quick Facts

Row count
2ⁿ rows for n variables
3 variables → 8 rows; 4 variables → 16 rows.
Operator precedence
NOT > AND > XOR > OR > IMPLIES > IFF
Highest to lowest binding; use parentheses to override.
Classification
Tautology / Contradiction / Contingency
Based on whether the result column is all True, all False, or mixed.

Your Results

Calculated
Classification
-
Tautology, contradiction, or contingency
True rows
-
Rows where the expression is True
False rows
-
Rows where the expression is False
Full truth table
-
All 2ⁿ rows, in binary counting order

Ready

Enter a Boolean expression using AND, OR, NOT, XOR, IMPLIES (->), and IFF (<->), then press Calculate.

How the Truth Table Generator​ works

A truth table is the definitive way to evaluate a Boolean (propositional logic) expression: it lists the value of the expression — True or False — for every possible combination of its input variables. This calculator parses the expression you type, applying standard logical operators and precedence rules, and evaluates it for all 2ⁿ combinations of up to four variables.

Formula and method

For an expression with n distinct variables, there are exactly 2ⁿ possible input combinations, since each variable is independently either True (1) or False (0). The generator lists rows in binary counting order — starting with every variable False and ending with every variable True — and evaluates the parsed expression for each row using the standard rules: AND (∧) is true only when both operands are true; OR (∨) is true when at least one operand is true; NOT (¬) flips the operand; XOR (⊕) is true when exactly one operand is true; IMPLIES (→) is false only when the left side is true and the right side is false; IFF (↔) is true when both sides share the same truth value. The tool then reports the resulting column alongside a classification of the whole expression.

Supported operators and precedence

Type variables as single letters (A, B, C, D) and combine them with AND, OR, NOT, XOR, XNOR, IMPLIES, and IFF — or their symbols &, |, !/~/¬, ^, ->, and <->. When an expression omits parentheses, operators bind from tightest to loosest in this order: NOT, then AND, then XOR, then OR, then IMPLIES, then IFF. For example, "A OR B AND NOT C" is evaluated as "A OR (B AND (NOT C))". Use parentheses whenever you want a different grouping.

Reading the classification

The generator labels the whole expression a tautology if the result column is True on every row (the statement is logically valid, like A OR NOT A), a contradiction if the result column is False on every row (logically impossible, like A AND NOT A), or a contingency if the result mixes True and False rows, meaning its truth value genuinely depends on the inputs.

Common sources of error

  • Missing parentheses: mixed AND/OR expressions without parentheses follow the precedence order above, which may not match what you intended — add parentheses to be explicit.
  • Too many variables: this generator supports up to four distinct variables (16 rows); expressions using a fifth variable will be rejected so the table stays readable.
  • Unmatched parentheses or stray symbols: every "(" needs a matching ")", and operators must have operands on both sides (except NOT, which takes one).

Applications

Truth tables are the standard tool for verifying digital logic circuits and gate combinations, checking whether two Boolean expressions are logically equivalent (they are equivalent exactly when their result columns match on every row), simplifying conditions in code and database queries, and teaching propositional logic in discrete mathematics and philosophy courses.

Frequently Asked Questions

What is a truth table?
A truth table lists every possible combination of True/False values for the variables in a Boolean expression, along with the resulting value of the expression for each combination. An expression with n variables has 2ⁿ rows.
Which operators and symbols does this truth table generator support?
You can use AND (&, ∧), OR (|, ∨), NOT (!, ~, ¬), XOR (^), XNOR, IMPLIES (->, →), and IFF (<->, ↔), combined with parentheses and up to four single-letter variables such as A, B, C, D.
What is the difference between a tautology, a contradiction, and a contingency?
A tautology is True on every row of its truth table (for example A OR NOT A). A contradiction is False on every row (for example A AND NOT A). A contingency is True on some rows and False on others, so its truth value depends on the inputs.
How many rows does a truth table have?
A Boolean expression with n distinct variables has exactly 2ⁿ rows, since each variable can independently be True or False: 2 rows for 1 variable, 4 for 2, 8 for 3, and 16 for 4.