Truth Table Generator
Build a truth table for any boolean expression with up to 6 variables. Supports AND, OR, NOT, XOR, IMPLIES, IFF in word, ASCII, and unicode forms. Flags tautologies, contradictions, and contingencies.
Boolean Operator Reference
| A | B | A AND B | A OR B | A XOR B |
|---|---|---|---|---|
| False | False | False | False | False |
| False | True | False | True | True |
| True | False | False | True | True |
| True | True | True | True | False |
Frequently Asked Questions about the Truth Table Generator
Which logical operators does this calculator support?
The calculator supports six standard propositional connectives, with several text, programming, and mathematical aliases. AND can be written AND, &&, *, or the Unicode conjunction symbol. OR can be written OR, ||, +, or the Unicode disjunction symbol. NOT can be written NOT, !, ~, or the Unicode negation symbol. XOR can be written XOR, ^, or a Unicode XOR symbol. IMPLIES can be written IMPLIES, ->, or a Unicode implication symbol. IFF can be written IFF, <->, or a Unicode biconditional symbol. Parentheses group sub-expressions. Variable names start with a letter or underscore, then may contain letters, digits, or underscores. They are case-sensitive, except reserved keywords. TRUE and FALSE are accepted. Precedence is NOT, AND, XOR, OR, IMPLIES, then IFF.
Why does a truth table always have 2^n rows?
Because each variable in a boolean expression has exactly two possible values, true or false, and the rows enumerate every combination. With one variable you have 2 rows (true, false). Adding a second variable doubles the count to 4, since each existing row now branches into two (the new variable is either true or false). A third variable doubles it again to 8, a fourth to 16, and so on. In general, n independent variables produce 2 to the power of n combinations, which is why this calculator caps the input at 6 variables (64 rows). At 6 variables a truth table is already at the edge of what is comfortable to read on screen; at 10 variables you would have 1024 rows, and at 20 over a million. For expressions that big you want a SAT solver or a model checker instead of a truth table.
What is the difference between a tautology, a contradiction, and a contingency?
A tautology is an expression that is true on every row of its truth table, no matter what values the variables take. The classic example is p OR NOT p, which is always true (either p is true, or its negation is). A contradiction is the opposite: false on every row regardless of the variables. p AND NOT p is the textbook example. A contingency is anything in between, an expression that is true on some rows and false on others. Most useful boolean expressions are contingencies; tautologies show up when you are proving a logical law (like De Morgan's), and contradictions show up when you are checking whether two conditions can both hold at once. This calculator labels the verdict at the top of the result panel, alongside how many of the 2^n rows came out true.
How do I check De Morgan's laws with this tool?
De Morgan's first law says NOT (p AND q) is logically equivalent to (NOT p) OR (NOT q); the second says NOT (p OR q) is equivalent to (NOT p) AND (NOT q). To verify either one, generate the truth table for both sides separately and compare them row by row. They should produce the same result column. For the first law, NOT (p AND q) is true on three out of four rows (every row except p = true, q = true), and (NOT p) OR (NOT q) gives exactly the same pattern. You can also check the equivalence in one shot by building the IFF of the two sides, like NOT (p AND q) IFF (NOT p) OR (NOT q). That whole expression is a tautology if the two sides are equivalent, so a green tautology verdict at the top of the result means the law holds for those variables.
How do I verify two expressions are logically equivalent?
Two boolean expressions are logically equivalent when they produce the same result on every row of the truth table over the union of their variables. The fastest way to check that here is to combine them into a single biconditional and look at the verdict. Build the expression LEFT IFF RIGHT and run it through the generator. If the verdict is Tautology (all rows true), the two expressions agree on every assignment, so they are logically equivalent. If the verdict is Contingency, they disagree on at least one row, and the rows where the Result column is false are exactly the assignments that prove they are not equivalent. This trick is how you can verify any logical law in a few seconds: implication elimination (p -> q IFF NOT p OR q), absorption (p AND (p OR q) IFF p), distributivity, double negation, and so on.
Related Calculators
More calculators in "Math"
Continued Fraction CalculatorCosine Similarity CalculatorPolynomial Long Division CalculatorPolynomial CalculatorCombinations and Permutations CalculatorMatrix Determinant Calculator
See all 202 calculators in "Math"