Truth Table Generator – Evaluate Any Logic Expression by Exhaustion
A truth table settles by brute force what a piece of logic actually does. Instead of arguing about whether (A → B) ∧ (B → C) really implies A → C, you list every combination of truth values and read the answer off the page. This truth table generator takes a propositional or Boolean expression, discovers the variables inside it, enumerates all 2ⁿ assignments, and prints the result for every row — together with the intermediate steps that got there.
Writing the expression
The parser is deliberately forgiving about notation. Discrete-maths students usually type NOT (A AND B), logicians prefer ¬(A ∧ B), and programmers reach for !(A && B). All three are the same expression here, and you can mix them in one line. Digital-logic shorthand works too: A·B + A′ parses as (A ∧ B) ∨ ¬A. Variables are any names starting with a letter, so P, Q, isAdmin and Cin are all fine.
Precedence, and why it matters
A ∨ B ∧ C is not ambiguous — AND binds tighter than OR, so it reads as A ∨ (B ∧ C). Implication is looser still and associates to the right, which is why A → B → C means A → (B → C). Because precedence surprises are the most common source of a wrong answer, the tool echoes your input back fully parenthesised and draws the parse tree, so you can confirm the grouping before trusting the table.
Classification and satisfiability
Once the result column exists, the verdict is a single scan. All rows true means a tautology — the formula is logically valid, and testing (premises) → conclusion this way is how you check an argument for validity. All rows false means a contradiction, which is another way of saying the expression is unsatisfiable. Anything in between is a contingency, and the tool reports how many of the 2ⁿ interpretations satisfy it along with one witness assignment.
Comparing two expressions
Enter a second expression and both get their own result column over the shared variable set. Identical columns mean the two formulas are logically equivalent — that is how you verify De Morgan’s laws, the contrapositive, or the distributive law. When the columns differ, the disagreeing rows are highlighted and the first one is named as a counterexample. That is far more useful than a bare “not equivalent”: A → B and B → A differ precisely when one side is true and the other false.
From table to circuit
Digital-logic work runs the other way — the table is the specification and the expression is the deliverable. The rows where the result is true are the minterms, written Σm(1, 2); the false rows are the maxterms, written ΠM(0, 3). From those the tool derives the canonical sum-of-products and product-of-sums forms, then runs Quine–McCluskey minimisation to collapse the canonical form down to its prime implicants. A four-term expression such as (A ∧ B) ∨ (A ∧ ¬B) reduces to plain A, and the gate count before and after tells you what the saving is worth. For two to four variables a Karnaugh map shows the same groupings laid out in Gray code.
Everyday uses beyond coursework
A tangled if condition with four boolean flags has sixteen possible states, and a truth table is the quickest way to find the branch that can never be reached or the pair of flags that turn out to be redundant. Pasting the condition in, minimising it, and confirming the simplified form has an identical column is a small refactor with a proof attached. The same table also doubles as a test matrix: every row is a case worth covering.