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.