Generate truth tables for logical expressions with up to 4 variables — AND, OR, NOT, XOR, NAND, NOR, IMPLIES, and XNOR — with tautology/contradiction detection and a visual result grid.
A truth table lists every possible combination of truth values for the variables in a logical expression and shows whether the expression evaluates to true or false in each case. Truth tables are the cornerstone of propositional logic, digital circuit design, and Boolean algebra.
This generator supports up to four variables (A, B, C, D) and eight logical operators: AND, OR, NOT, XOR, NAND, NOR, IMPLIES (→), and XNOR (↔). Type any well-formed expression — from a simple "A AND B" to a nested formula like "(A OR B) AND (NOT C IMPLIES D)" — and the tool produces a complete truth table with color-coded results. It instantly classifies the expression as a tautology (always true), a contradiction (always false), or contingent, and shows the true/false ratio in a visual bar.
Preset buttons load common expressions so you can explore operator behaviour without typing. The operator reference table at the bottom summarises every supported connective. An input-pattern grid provides a minimap of which combinations are true or false. Whether you are studying for a discrete-maths exam, designing a combinational logic circuit, or debugging a Boolean filter in code, this truth-table generator is the quickest way to check your reasoning.
Writing out every row of a truth table by hand is mechanical but error-prone, especially for 3- or 4-variable expressions where the table has 8 or 16 rows. This calculator parses any combination of AND, OR, NOT, XOR, NAND, NOR, IMPLIES, and XNOR with up to 4 variables, generates the complete table instantly, and classifies the expression as a tautology, contradiction, or contingent formula. It highlights true rows in green so patterns jump out, and is invaluable for verifying logical equivalences and De Morgan transformations.
AND: T iff both T | OR: T iff at least one T | NOT: flips | XOR: T iff different | IMPLIES: F only when T→F | XNOR: T iff same
Result: 1 true row out of 4
A AND B is true only when both A and B are true (row 4). It is contingent — neither a tautology nor a contradiction.
The calculator assigns all possible combinations of true/false to the variables (2ⁿ rows for n variables), evaluates the expression for each combination, and displays the result in a standard truth-table format. Operator precedence follows conventions: NOT binds tightest, then AND, then OR/XOR, then IMPLIES, then XNOR. Use parentheses to override precedence whenever the default order doesn't match your intent.
If every row evaluates to true, the expression is a tautology — a logical law (e.g., A OR NOT A). If every row is false, it's a contradiction (e.g., A AND NOT A). Otherwise, it's contingent. Recognising tautologies is essential for validating proof steps, and contradictions signal inconsistent assumptions. The calculator's classification saves you from scanning every row manually.
A set of operators is functionally complete if any Boolean function can be expressed using only those operators. {AND, NOT} is complete, as is {NAND} alone or {NOR} alone. Entering expressions built from a single gate type and checking their truth tables against the target function is a practical way to verify functional-completeness constructions, a key exercise in digital-logic and discrete-math courses.
AND, OR, NOT, XOR, NAND, NOR, IMPLIES (→), and XNOR (↔). You can also use &&, ||, !, and -> as shorthand.
Up to 4 (A, B, C, D). Each variable doubles the number of rows, so 4 variables give 16 rows.
An expression that is true for every possible assignment of truth values — for example, "A OR NOT A". Use this as a practical reminder before finalizing the result.
An expression that is false for every possible assignment — for example, "A AND NOT A". Keep this note short and outcome-focused for reuse.
"A IMPLIES B" (A → B) is false only when A is true and B is false. In all other cases it is true.
Yes — use parentheses for grouping. For example, "(A AND B) OR (NOT C)" is valid.