Truth table generator for any logic expression
A truth table lists every combination of true (1) and false (0) for the inputs of a logic expression, and the output for each. With n inputs there are 2ⁿ rows, so three inputs give 8. This truth table generator builds the full table for any expression you type, in words (AND, OR, NOT), logic symbols (∧ ∨ ¬) or electronics notation (· + ′), with a column for each step, and says whether the expression is a tautology, a contradiction or neither.
It opens on (A AND B) OR NOT C. Open the full truth table generator over this page to type your own.
Truth Table Generator
Build the truth table for any logic expression
How to use the truth table generator
- Type the expression in the Expression box. Variables are single letters, and you can mix notations: A AND B, A ∧ B, A·B and AB (implied AND) all mean the same.
- Choose how the answer is written: AND OR, ∧ ∨ ¬ or · + ′.
- Turn on Show each step to get a column for every part of the expression, not just the final output.
- Read the result: tautology, contradiction or contingent, the number of rows, and which rows are true and false.
- Below the table are the canonical forms: the expression rebuilt from its true rows (sum of minterms) and from its false rows (product of maxterms).
- Try the examples, or press Random problem in the Practice section.
| Operation | Words | Symbols | True when |
|---|---|---|---|
| NOT | NOT A | ¬A or A′ | A is false |
| AND | A AND B | A ∧ B or A·B | Both are true |
| OR | A OR B | A ∨ B or A + B | At least one is true |
| XOR | A XOR B | A ⊕ B | Exactly one is true |
| NAND | A NAND B | A ↑ B | Not both true |
| NOR | A NOR B | A ↓ B | Neither is true |
| Implies | A IMPLIES B | A → B or A -> B | Except when A is true and B false |
| If and only if | A IFF B | A ↔ B or A <-> B | Both the same |
It handles up to 8 variables, which is 256 rows. XNOR is also accepted, as the opposite of XOR.
How to make a truth table by hand
- Count the variables, n. The table has 2ⁿ rows.
- List every combination by counting in binary: 000, 001, 010 and so on.
- Add a column for each part of the expression, working from the inside out: brackets and NOT first, then AND, then OR.
- Fill in each column row by row, using the columns you already have.
Worked examples you can check in the generator
Example 1: (A AND B) OR NOT C
| A | B | C | A AND B | NOT C | Output |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 | 1 |
The output is true on 5 of the 8 rows: whenever C is false, and also when A and B are both true. Numbering the rows 0 to 7 as binary, it is true on rows 0, 2, 4, 6 and 7. It is contingent: true on some rows and false on others.
Example 2: XOR
A XOR B is true only when the inputs differ: on 01 and 10, false on 00 and 11. The same table comes from A′B + AB′ in electronics notation, one of the generator's examples, which shows the two expressions are equivalent.
Example 3: tautology and contradiction
A OR NOT A is true on every row, so it is a tautology. A AND NOT A is false on every row, a contradiction. The generator names these at the top of the result.
Example 4: checking De Morgan's law
De Morgan's law says NOT (A AND B) is the same as NOT A OR NOT B. Type (NOT (A AND B)) IFF (NOT A OR NOT B). If the two sides always match, IFF is true on every row, and the generator reports a tautology. That is how to prove any two expressions are equivalent with a truth table.
Example 5: implication
A → B is false only when A is true and B is false. It is true on the other three rows, including both rows where A is false. This surprises many people: a promise "if it rains, I'll take an umbrella" isn't broken on a dry day.
Try one
Common mistakes
- Missing rows. With n inputs there are exactly 2ⁿ rows. Count in binary so none are skipped.
- Ignoring the order of operations. NOT binds tightest, then AND, then OR. Use brackets when in doubt.
- Mixing up OR and XOR. OR is true when both inputs are true; XOR is not.
- Applying NOT to the wrong part. NOT (A AND B) is not the same as NOT A AND NOT B.
- Typing variable names longer than one letter. The generator reads AB as A AND B.
Common questions
How many rows does a truth table have?
How do you make a truth table?
What is a tautology?
How do you prove two logic expressions are equivalent?
What notation can I type?
Revision cards
Read the front, say your answer, then flip to check.
Where to go next
- Solve it
Truth Table Generator
Build the truth table for any logic expression
Open the tool - Test it
AP Computer Science Principles
A new exam-style paper every day, with instant marking and a mark scheme
Start today's paper - Test it
College Discrete Math
A new exam-style paper every day, with instant marking and a mark scheme
Start today's paper