How to use the truth table generator
- Type a boolean expression using variables such as A, B and C, or words such as rain and umbrella. You can also click one of the examples.
- Use the operators NOT, AND, XOR, OR, IMPLIES (->) and IFF (<->), plus parentheses. Symbols such as &, |, ^, ! and the logic symbols also work.
- Read the table. Each row is one assignment of 0 or 1 to the variables, and the last column is the result. Switch to T and F if you prefer, and hide or show the sub-expression columns.
- Check the type (tautology, contradiction or contingent), the number of true rows, the minterms and the canonical sum of products, then copy the table if you need it.
Worked example
Take A AND (B OR NOT C) with three variables, so the table has 8 rows. The result is true only when A is 1 and either B is 1 or C is 0. That happens in rows 100, 110 and 111, which are rows 4, 6 and 7 counting from 0. The expression is contingent, with 3 true rows, and its canonical sum of products is (A and not B and not C) or (A and B and not C) or (A and B and C).
For A -> B the rows 00, 01 and 11 are true and only 10 is false, so the minterms are 0, 1 and 3. The expression NOT (A AND B) <-> (NOT A OR NOT B) is true in all 4 rows, which shows De Morgan's law and makes it a tautology.
Operators and precedence
When you leave out parentheses, the tool groups operators from tightest to loosest in this order: NOT, AND, XOR, OR, IMPLIES, IFF. So A | B & C means A | (B & C), and A | B ^ C means A | (B ^ C). IMPLIES is right associative, so A -> B -> C means A -> (B -> C), which is a different table from (A -> B) -> C. Other textbooks and programming languages may rank XOR differently, so add parentheses whenever the grouping matters to your answer.
Reading the table
Rows count up in binary with the first variable as the most significant bit, so the first row has every variable at 0 and the last row has every variable at 1. Variables are listed in the order they first appear in your expression. Sub-expression columns show each operator step, which is useful for checking homework or tracing why a row is true. An expression is a tautology when every row is true, a contradiction when every row is false, and contingent otherwise.
Minterms and sum of products
A minterm is a row where the result is true, written as an AND of every variable, with a NOT on the variables that are 0 in that row. Joining all minterms with OR gives the canonical sum of products, which always describes the same function as the original expression. The list m(4, 6, 7) uses the row numbers. Two expressions are logically equivalent when their result columns match row for row, which you can test by writing them as one expression joined with <->.
Limits
The table is limited to six variables, which is 64 rows, so it stays readable and fast. Unbalanced parentheses, a missing operand or an unknown character produce a message with the position. The expression is read by a small parser and is never run as code. For counting arrangements and probabilities, try the combinations and permutations calculator or the probability calculator.
Assumptions and limits
- Precedence from tightest to loosest is NOT, AND, XOR, OR, IMPLIES, IFF, with IMPLIES grouping to the right. Use parentheses if your course or language ranks them differently.
- Names are case sensitive variables, so A and a are different variables. The words and, or, not, xor, true and false are operators and constants in any letter case, and the digits 0 and 1 are constants.
- Rows run in binary order starting with every variable false. The result always has one row for each assignment, up to 64 rows for six variables.
- The tool checks logic only. It does not simplify an expression or draw a circuit, and everything runs in your browser with nothing uploaded.
Frequently asked questions
How many variables can a truth table have here?
Up to six, which gives 64 rows. A seventh variable would double the table to 128 rows, so the tool stops with a message that lists the variables it found. If you need more, split the expression into parts and test each part.
How do I know if two expressions are equivalent?
Join them with <-> and look at the type. If the result is a tautology, the two expressions are true and false together in every row, so they are equivalent. You can also build each table separately and compare the result columns.
What is the difference between a tautology and a contingent expression?
A tautology is true in every row, like A OR NOT A. A contingent expression is true in some rows and false in others, like A AND B. A contradiction is false in every row, like A AND NOT A. The page shows which one your expression is.
Why does A -> B -> C give a different table from (A -> B) -> C?
Implication is not associative. Without parentheses the tool reads A -> B -> C as A -> (B -> C), which is false only in the row where A and B are 1 and C is 0. The other grouping is false in more rows, so add parentheses to say which one you mean.
What does the m(4, 6, 7) list mean?
It lists the rows where the result is true, numbered from 0 in binary order with the first variable as the highest bit. For three variables A, B and C, row 4 is 100, row 6 is 110 and row 7 is 111. Each number corresponds to one product term in the sum of products.