Truth Table Generator
Enter a Boolean or propositional expression to generate its truth table. Use AND, OR, NOT, XOR, NAND, NOR, implication or biconditional, with up to twelve variables. Switch to Every step for intermediate columns, check tautology and satisfiability, or copy and export the full table as CSV. The core tool runs in your browser and needs no account.
reads as ((p OR q) AND (NOT r))
-> is false only when the left side is true and the right side is false. NOT binds tightest, then AND and NAND, then XOR and XNOR, then OR and NOR, then ->, then <->. A chain of -> groups to the right, every other chain groups to the left.
| p | q | r | (p OR q) AND NOT r |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 0 |
satisfiableyes, 3 of 8 rowstautologyno
- Variables
- 3
- Rows
- 8
- True rows
- 3
- Tautology
- No
(p OR q) AND NOT r: 3 variables, 8 rows, 3 true. Satisfiable on 3 of 8 rows, and not a tautology.
Your expression
How the table reads
- Values
- First row
- Columns
Type the expression and the table follows. AND, OR, NOT, XOR, NAND, NOR, -> for implies and <-> for if and only if all read the way the table further down lists them, so &&, |, ~, ^, => and <=> arrive at the same place. NOT binds tightest, then AND, then XOR, then OR, then ->, then <->, and the line above the table prints the reading in full brackets so you can see exactly how your expression grouped. Up to twelve variables, which is 4,096 rows: the panel draws the first 256 rows and scrolls, while Copy and the CSV carry every one of them. Variable names are case sensitive, so P and p are two columns, and T and F are ordinary variables: write 1, 0, true or false when you mean a constant. Your expression is kept in this browser so the page opens where you left it, and the Start over button at the top of the page forgets it.
What you can type
| Operator | Binds | Also written | True when |
|---|---|---|---|
| NOT | 1 | NOT ! ~ ¬ p' | true when the one side is false |
| AND | 2 | AND && & ∧ * . · | true only when both sides are true |
| NAND | 2 | NAND ↑ | false only when both sides are true |
| XOR | 3 | XOR ^ ⊕ != ≠ | true when the two sides differ |
| XNOR | 3 | XNOR | true when the two sides match |
| OR | 4 | OR || | ∨ + | true when either side is true, or both |
| NOR | 4 | NOR ↓ | true only when both sides are false |
| -> | 5 | -> => → ⇒ ⊃ > IMPLIES | false only when the left side is true and the right side is false |
| <-> | 6 | <-> <=> ↔ ⇔ ≡ = == IFF EQUIV | true when the two sides match |
Common questions
- When is p implies q false?
- Only when p is true and q is false. Every other row is true, including the two where p is false, which is the part that feels wrong the first time: a conditional with a false left side makes no claim, so it is counted true. That is the material conditional every logic course uses, and the table on this page follows it: p -> q has four rows and three of them are true. A chain groups to the right, so p -> q -> r reads as p -> (q -> r) and seven of its eight rows are true, while (p -> q) -> r has five. The page prints which of the two it used in brackets above the table, so you never have to guess.
- Which operator binds tightest?
- NOT binds tightest, then AND and NAND, then XOR and XNOR, then OR and NOR, then implies, and the biconditional is loosest. A chain of implications groups to the right; every other chain groups to the left. It matters: (p OR q) AND NOT r is true on three of its eight rows, while the same characters without the brackets, p OR q AND NOT r, read as (p OR (q AND (NOT r))) and come out true on five. Rather than ask you to trust the convention, the page prints the fully bracketed reading above the table, so you can see exactly how your expression was grouped and add brackets if that is not what you meant.
- Which symbols can it read?
- The words AND, OR, NOT, XOR, NAND, NOR, XNOR, IMPLIES and IFF in any case, and the symbols beside them in the table under the tool: &&, &, *, . for AND, ||, |, + for OR, !, ~ for NOT, ^ and != for XOR, ->, =>, > for implies, and <->, <=>, ==, = for if and only if. The logic symbols are read too, and a prime after a variable negates it the way a Karnaugh map writes it, so p' is NOT p. Operator words ignore case, but variable names do not: P and p are two different columns. T and F are ordinary variables, so write 1, 0, true or false when you mean a constant.
- How many variables can it handle?
- Twelve, which is 4,096 rows. A thirteenth would be 8,192 rows and is refused with that number in the message rather than left to lock up the page, and nothing is quietly cut short instead. The panel draws the first 256 rows, which is every row up to eight variables, and scrolls; Copy puts the whole table on the clipboard and the CSV file carries all 4,096 rows, with one column per variable and one for the result, and a column for each sub-expression in between when Columns is set to Every step.
- How do I tell a tautology from a contradiction?
- The four figures under the panel answer it directly: Rows, True rows and Tautology, with the satisfiable line inside the panel. A tautology is true on every row, so p OR NOT p reads tautology yes. A contradiction is true on none, so p AND NOT p has two rows, no true row at all, and the page says it is a contradiction and not satisfiable. Anything in between is satisfiable but not a tautology, and the line names how many rows make it true.
- Can I check whether two expressions are equivalent?
- Yes, by joining them with <-> and looking at the Tautology figure. Two expressions are equivalent exactly when their biconditional is true on every row. NOT (p AND q) <-> (NOT p OR NOT q) is true on all four of its rows, which is De Morgan's law; (p -> q) <-> (NOT q -> NOT p) is true on all four as well, which is contraposition. If the answer comes back as anything short of a tautology, the rows that are false are the cases where the two expressions part company.
- Can I see the working rather than just the answer?
- Set Columns to Every step. Each sub-expression then gets a column of its own, children before parents, so (p OR q) AND NOT r is drawn as p OR q, then NOT r, then the whole thing, and a sub-expression that appears twice gets one column rather than two. The CSV keeps those columns too. An expression with more working columns than the panel draws is shown with the result column alone and a line that says how many steps it had, rather than a table cut off without saying so.
- Is my expression sent anywhere?
- No. The parsing and the evaluation happen in your browser, there is no account and nothing is uploaded, and the CSV file is built in the page rather than fetched from a server. Your expression and your display settings are kept in this browser's own storage so the page opens where you left it, and the Start over button at the top of the page forgets them. If your browser blocks storage the tool still works: it opens on the example every time.
- How do I make an even or odd parity generator truth table?
- For three data bits, enter a XOR b XOR c. Its output is the parity bit to append so the total number of 1s, including that bit, is even. For an odd total, enter NOT (a XOR b XOR c). Add XOR d for four data bits, or continue with distinct names up to twelve inputs. This is a parity-bit generator: the XOR result also detects whether the data alone has an odd number of 1s.
- Can I check an argument with multiple premises and a conclusion?
- Join the premises with AND, then imply the conclusion. For premises p -> q and p with conclusion q, enter ((p -> q) AND p) -> q. If Tautology says yes, no assignment makes all premises true and the conclusion false, so the propositional argument is valid. If it is not a tautology, a false result row supplies a counterexample. This uses symbolic propositions; it does not translate prose or evaluate quantified predicate logic.
- Can I generate a table for p, q and r or for logic gates?
- Use separate variable names in an expression, such as (p OR q) AND NOT r. Three variables give eight rows and four give sixteen. Gate words such as AND, NAND, OR, NOR and XOR are supported in expressions. A name such as pqr is one variable, so write the operators between p, q and r when you mean three inputs. The page does not import circuit drawings or generate a gate diagram.
The expression is parsed into a tree and every row is evaluated from that tree, so nothing you type is ever run as code. Up to twelve variables, which is 4,096 rows; past that it refuses rather than freezing the page. Implication is false only when the left side is true and the right side is false, and that convention is printed above the table.