Truth Table Generator
Type a logical expression with up to 10 variables and get every row of its truth table, plus whether it is a tautology, a contradiction or contingent.
Runs in your browser. Nothing you enter is sent to a server. Sources: IEP Updated
Logic operators the truth table generator accepts
| Operator | Type it as | The result is true when |
|---|---|---|
| NOT | ! ~ ¬ not | the part after it is false |
| AND | && & ∧ and | both sides are true |
| XOR | ^ ⊕ xor | exactly one side is true |
| OR | || | ∨ or | at least one side is true |
| IMPLIES | -> => → implies | always, except when the left side is true and the right side is false |
| IFF | <-> <=> ↔ iff | both sides have the same value |
Variables are single letters from A to Z. Capitals and lowercase are the same variable. Note that ^ means XOR here, as it does in C, Java, JavaScript and Python. For AND use && or ∧.
Order of operations: NOT, AND, XOR, OR, IMPLIES, IFF
Parentheses are worked out first. After that the tool applies NOT, then AND, then XOR, then OR, then IMPLIES, and IFF last. The table above is in that order.
Two operators of the same kind are grouped from the left, with one exception: IMPLIES is grouped from the right, so A -> B -> C is read as A → (B → C).
This order is the rule this tool uses. Textbooks and programming languages do not all agree on one, and many logic texts expect you to write the parentheses yourself.
So when you copy an expression from a book, keep its parentheses, and check the "Read as" line under the buttons. It repeats your expression with every group written out.
Truth table example: (A or B) implies C
Enter (A || B) -> C. There are three variables, so the table has 2 × 2 × 2 = 8 rows:
| A | B | C | (A ∨ B) → C |
|---|---|---|---|
| T | T | T | T |
| T | T | F | F |
| T | F | T | T |
| T | F | F | F |
| F | T | T | T |
| F | T | F | F |
| F | F | T | T |
| F | F | F | T |
The expression is false in the three rows where A or B is true but C is false. In the last row both A and B are false, so the left side is false and the conditional is true. The tool reports "True in 5 of 8 rows. It is contingent: true in some rows and false in others."
Tautology, contradiction or contingent: how to tell
- A tautology is true in every row. Try
A || !A. - A contradiction is false in every row. Try
A && !A. - Everything else is contingent: true in some rows and false in others.
Two expressions are equivalent when they have the same value in every row. To test that, join them with <->. For example !(A && B) <-> (!A || !B), one of De Morgan's laws, comes out as a tautology.
How many rows a truth table has
Each variable can be true or false, so n variables give 2ⁿ rows.
| Variables | Rows |
|---|---|
| 1 | 2 |
| 2 | 4 |
| 3 | 8 |
| 4 | 16 |
| 5 | 32 |
| 6 | 64 |
| 8 | 256 |
| 10 | 1,024 |
With "T and F" the first row has every variable true and the last row has every variable false. With "1 and 0" the rows count upward in binary from 0 (000, 001, 010 and so on). "Copy table" copies the table as tab-separated text, which pastes into a spreadsheet as separate columns.
The "1 and 0" rows are the binary numbers from 0 upward, the same notation text to binary uses for bytes. To print a table in a paper, type its rows into the LaTeX table generator. More tools for code and data are under developer tools.
Truth Table Generator: FAQ
Why is A -> B true when A is false?
What is the difference between OR and XOR?
How do I check that two expressions are equivalent?
iff and put each one in parentheses, for example (not (A and B)) iff (not A or not B). If the result says tautology, the two expressions have the same value in every row, which is what equivalent means.Can I use lowercase letters or longer names?
a and A are one variable. Names longer than one letter are not accepted, because the words AND, OR, NOT, XOR, IMPLIES and IFF are read as operators. Use one letter for each statement.Why is there a limit of 10 variables?
Sources
- Internet Encyclopedia of Philosophy: Propositional Logic — truth tables of the connectives, the 2ⁿ row count, and the definitions of tautology, self-contradiction and contingent statement (checked October 12, 2026)