World’s largest virtual agentic engineering & quality conference
Turn any boolean expression into a full truth table with every variable combination and its tautology verdict, and a downloadable test case view.
A truth table generator is a tool that takes a boolean expression, works out every possible combination of true and false values for its variables, and prints the result of the expression for each one. An expression with n variables produces 2 to the power n rows, so three variables always give exactly eight rows.
The table is the underlying artifact behind decision table testing, one of the test design techniques specified in ISO/IEC/IEEE 29119-4, the software testing standard published on October 28, 2021. If you are working at the bit level rather than the condition level, the Bitwise Calculator and XOR Calculator handle single operations on numbers instead.
The generator runs four steps in order, entirely in JavaScript in your browser:
All processing happens in your browser. No data is uploaded. The expression you type is never sent to a server, and the page writes nothing to local storage.
Nine operators are supported, each with several accepted notations so you can paste an expression from code, from a textbook, or from a design document without rewriting it. Operator keywords are case insensitive.
| Operator | Accepted notations | True when |
|---|---|---|
| NOT | NOT, !, ~, ¬ | The operand is false |
| AND | AND, &&, &, ∧ | Both operands are true |
| OR | OR, ||, |, ∨ | At least one operand is true |
| XOR | XOR, ^, ⊕ | The operands differ |
| NAND | NAND, ↑ | At least one operand is false |
| NOR | NOR, ↓ | Both operands are false |
| XNOR | XNOR | The operands match |
| IMPLIES | IMPLIES, ->, =>, →, ⊃ | The left side is false or the right side is true |
| IFF | IFF, <->, <=>, ↔, ≡ | Both sides share the same value |
Constants are written as TRUE and FALSE, or as 1 and 0. The single letters T and F are read as ordinary variables, which keeps classroom expressions such as T AND F working as a two variable table. To move between number bases while building an expression, use the Decimal to Binary converter.
Precedence decides how an unparenthesized expression is grouped. The order below follows the relative ranking that MDN operator precedence gives the three operators JavaScript shares with boolean logic: logical NOT at precedence 14, logical AND at 4, and logical OR at 3.
| Tier | Operators | Associativity |
|---|---|---|
| 1 (binds tightest) | NOT | Right to left |
| 2 | AND, NAND | Left to right |
| 3 | XOR, XNOR | Left to right |
| 4 | OR, NOR | Left to right |
| 5 | IMPLIES | Right to left |
| 6 (binds loosest) | IFF | Left to right |
So A OR B AND C is read as A OR (B AND C), and A -> B -> C is read as A -> (B -> C). The header of the result column always prints the expression as the parser grouped it, so you can confirm the reading before trusting the table.
A boolean condition in production code is a specification for a set of test cases. Each row of its truth table is one combination of conditions and one expected outcome, which is exactly the shape decision table testing asks for in ISO/IEC/IEEE 29119-4.
TestMu AI runs those suites on a cloud of 10,000+ real devices and 3000+ browsers, so a decision table derived here can be executed against every environment the condition has to hold on. For bit level checks inside the same workflow, see the Binary Calculator and Bit Shift Calculator.
A truth table has 2 raised to the power n rows, where n is the number of distinct variables in the expression. Two variables produce 4 rows, three variables produce 8 rows, and eight variables produce 256 rows. Each row is one unique combination of true and false values across every variable.
This truth table generator accepts up to 8 distinct variables, which produces a 256 row table. Expressions using 9 or more variables are rejected with a message naming the variable count, because the row count doubles with every added variable and a 9 variable table would need 512 rows.
Yes. Variable names are case sensitive, so a and A count as two separate variables. Names may be longer than one character, which lets you write readable conditions such as isLoggedIn AND hasPayment. Operator keywords like AND and NOT are case insensitive and are never treated as variables.
Yes. This truth table generator treats T and F as ordinary variables, not as constants, because single letter names in that range are common in logic exercises. To write a fixed constant instead, use the keywords TRUE and FALSE or the digits 1 and 0, which are never parsed as variable names.
Yes. Parentheses may be nested to any depth and always override operator precedence. An unmatched parenthesis produces the message Missing a closing parenthesis or Missing an opening parenthesis rather than a wrong table, so a typo in a long condition is reported instead of silently changing the result.
The generator replaces the table with a plain language message that names the problem. Entering A AND returns The expression ends unexpectedly. Add the missing operand, and entering A B returns a message asking for an operator between the two operands. No stack trace or partial table is shown.
A tautology is true in every row of its truth table, such as A OR NOT A. A contradiction is false in every row, such as A AND NOT A. A contingency is true in some rows and false in others. This generator labels each expression with one of the three verdicts above the table.
Read a truth table one row at a time. The leftmost columns hold one combination of variable values, and the final column gives the value of the whole expression under that combination. Rows here run from all true at the top down to all false at the bottom, unless you reverse the variable order.
Material implication is defined as false in exactly one case, when the left side is true and the right side is false. Every other combination is true, including both rows where A is false. This is why the implication column shows true, false, true, true reading from the all true row downward.
A minterm is an AND term that is true in exactly one row of a truth table, and a maxterm is an OR term that is false in exactly one row. Collecting the minterms for every true row yields a sum of products expression, while collecting maxterms yields a product of sums expression.
Yes. The Download CSV button exports whichever view is active. The Table view exports the variable columns and the result column. The Test cases view exports one row per test case with an identifier and an expected result, ready to import into a test management tool.
No. Parsing, evaluation, CSV generation and clipboard copying all run in JavaScript inside your browser. The expression you type is never uploaded, logged or stored, and the page writes nothing to local storage, so closing the tab discards everything you entered.
OR is true whenever at least one operand is true, including the row where both are true. XOR is true only when the two operands differ, so it is false when both are true and false when both are false. The two operators differ in exactly one row of a two variable table.
Did you find this page helpful?
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance