Truth Table Generator (Free Logic Calculator)
Fractions & numbersFreeNo sign-up
A truth table generator lists every combination of true (T) and false (F) values for the variables in a logical statement and works out the statement in each row. With n variables there are 2ⁿ rows. For example, (A ∧ B) ∨ ¬C has 3 variables, so 2³ = 8 rows, and it is true in 5 of them, which makes it a contingency.
((p → q) ∧ ¬q) → ¬p is a tautology: it is true in every row.
| p | q | p → q | ¬q | (p → q) ∧ ¬q | ¬p | ((p → q) ∧ ¬q) → ¬p |
|---|---|---|---|---|---|---|
| T | T | T | F | F | F | T |
| T | F | F | T | F | F | T |
| F | T | T | F | F | T | T |
| F | F | T | T | T | T | T |
Normal forms
Show steps
- Read the expression with the usual precedence (¬ first, then ∧, ⊕, ∨, →, ↔; → groups from the right). With full parentheses it is (((p → q) ∧ ¬q) → ¬p).
- There are 2 variables (p, q), so the table has 2² = 4 rows. The first variable alternates slowest, starting with T; the last alternates every row.
- Work from the inside out, one column per sub-expression: p → q; then ¬q; then (p → q) ∧ ¬q; then ¬p; then ((p → q) ∧ ¬q) → ¬p.
- Rules for the operators used: p → q is F only when p is T and q is F; in every other row it is T. p ∧ q is T only when both parts are T. ¬p flips the value: T becomes F and F becomes T.
- The last column is the whole expression. It is T in 4 rows and F in 0, so it is a tautology.
Two expressions are logically equivalent when their final columns match in every row. Use the Equivalence tab to check.
How to use the truth table generator
- Type a logical expression, such as (p → q) ∧ ¬q → ¬p. Use the symbol buttons or type words and keyboard symbols (AND, &, OR, |, NOT, ~, ->, <->).
- Read the table: one column per variable, one column per sub-expression, and the full expression in the green column on the right.
- See whether the statement is a tautology, a contradiction or a contingency, plus its simplified DNF and CNF, Boolean sum of products, minterms and maxterms.
- Switch to Equivalence to compare two expressions, or to Argument check to test whether premises lead to a conclusion.
- Change T/F to 1/0 or flip the row order to match your textbook, and copy the table as a spreadsheet, Markdown or LaTeX.
Logical operators you can use
| Operator | Symbol | You can also type | True when |
|---|---|---|---|
| NOT (negation) | ¬p | ~p, !p, NOT p, p′ | p is false |
| AND (conjunction) | p ∧ q | &, &&, *, AND | both are true |
| OR (disjunction) | p ∨ q | |, ||, +, OR | at least one is true |
| XOR (exclusive or) | p ⊕ q | ^, XOR | exactly one is true |
| IMPLIES (conditional) | p → q | ->, =>, IMPLIES | p is false or q is true |
| IFF (biconditional) | p ↔ q | <->, <=>, =, IFF | both have the same value |
| NAND | p ↑ q | NAND | not both are true |
| NOR | p ↓ q | NOR | both are false |
Without parentheses, the generator follows the usual order: ¬ first, then ∧, ⊕, ∨, → and finally ↔. A chain of arrows groups from the right, so p → q → r means p → (q → r). When in doubt, add parentheses.
Truth tables of the basic connectives
| p | q | ¬p | p ∧ q | p ∨ q | p ⊕ q | p → q | p ↔ q |
|---|---|---|---|---|---|---|---|
| T | T | F | T | T | F | T | T |
| T | F | F | F | T | T | F | F |
| F | T | T | F | T | T | T | F |
| F | F | T | F | F | F | T | T |
The row that surprises most students is p → q with p false: a conditional with a false “if” part counts as true. The only way to break “if p, then q” is p true and q false.
How to make a truth table by hand
- List the variables and count the rows: 2ⁿ for n variables (2 → 4 rows, 3 → 8, 4 → 16).
- Fill the first variable column with T for the top half and F for the bottom half. Halve the block size for each next column, so the last column alternates T, F, T, F.
- Add a column for each sub-expression, working from the inside of the parentheses outward.
- Finish with the full expression and read its column.
Worked examples
(A AND B) OR NOT C
There are 8 rows. A ∧ B is true only in the 2 rows where A and B are both true, and ¬C is true in the 4 rows where C is false. Their OR is true in 2 + 4 − 1 = 5 rows, because the row A = T, B = T, C = F is counted in both. So the expression is a contingency, true in 5 of 8 rows.
Modus ponens: ((p → q) ∧ p) → q
p → q and p are both true only in the row p = T, q = T, and there q is true. In every other row the “if” part is false, so the whole conditional is true. The expression is true in all 4 rows, so it is a tautology, which is why modus ponens is a valid rule of inference.
(A XOR B) AND C
The result is 1 only when C = 1 and exactly one of A and B is 1: the rows A = 1, B = 0, C = 1 and A = 0, B = 1, C = 1. That is 2 of 8 rows, minterms Σm(3, 5).
Tautology, contradiction or contingency
- Tautology: true in every row, such as p ∨ ¬p.
- Contradiction: false in every row, such as p ∧ ¬p.
- Contingency: true in some rows and false in others, such as p ∧ q.
A statement is satisfiable when at least one row makes it true, so every tautology and every contingency is satisfiable.
Logical equivalence and common laws
Two statements are logically equivalent (≡) when their final columns agree in every row. These standard equivalences all check out in the Equivalence tab:
| Law | Equivalence |
|---|---|
| De Morgan | ¬(p ∧ q) ≡ ¬p ∨ ¬q and ¬(p ∨ q) ≡ ¬p ∧ ¬q |
| Implication | p → q ≡ ¬p ∨ q |
| Contrapositive | p → q ≡ ¬q → ¬p |
| Biconditional | p ↔ q ≡ (p → q) ∧ (q → p) |
| Distributive | p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r) |
| Exportation | (p ∧ q) → r ≡ p → (q → r) |
The converse q → p is not equivalent to p → q: they differ when p = T, q = F and when p = F, q = T.
DNF and CNF from a truth table
To get the disjunctive normal form (DNF), write one AND-term for each true row and join the terms with ∨. For the conjunctive normal form (CNF), write one OR-clause for each false row that is false exactly in that row, and join the clauses with ∧. The generator then combines terms that differ in a single variable (the Quine–McCluskey method) to give the shortest forms. For (A ∧ B) ∨ ¬C the simplified CNF is (A ∨ ¬C) ∧ (B ∨ ¬C); in Boolean algebra notation the expression is AB + C′.
Checking an argument with a truth table
An argument is valid when every row that makes all premises true also makes the conclusion true. A row with true premises and a false conclusion is a counterexample. For example, p → q, q, therefore p (affirming the consequent) is invalid: p = F, q = T makes both premises true and the conclusion false. Modus tollens, p → q, ¬q, therefore ¬p, is valid.
Common mistakes
- Wrong number of rows. Three variables need 8 rows, not 6. Count 2ⁿ.
- Treating p → q as false when p is false. It is true in that case.
- Reading ∨ as “one or the other but not both”. That is XOR; ∨ is also true when both parts are true.
- Missing parentheses. ¬p ∧ q is (¬p) ∧ q, not ¬(p ∧ q).
- Confusing a statement with its converse. p → q and q → p have different columns.
Truth tables practice quiz: 10 questions
Test yourself with 10 multiple-choice questions. Choose an answer and press Submit to see if you are right and why. Your score appears at the end.
A conditional fails only when the 'if' part is true and the 'then' part is false.
p ∨ q is false only when both p and q are false, so it is true in 3 rows.
p ∨ ¬p is true whether p is T or F. p ∧ ¬p and p ⊕ p are always false, and p → ¬p is false when p is T.
The contrapositive ¬q → ¬p always has the same truth table as p → q. The converse and inverse do not.
C is true in 4 rows, and A ∧ B adds one more row (A = T, B = T, C = F): 4 + 1 = 5.
With p = F and q = T both premises are true but the conclusion p is false. This fallacy is called affirming the consequent.
The biconditional is T for (T, T) and (F, F) and F for the two mixed rows.
Quiz complete
Frequently asked questions
How do you use a truth table generator?
Type the statement with letters for the variables and symbols or words for the operators, for example (p -> q) & ~q. The generator builds every row, shows each sub-expression, and tells you whether the statement is a tautology, a contradiction or a contingency.
How do you learn truth tables?
Memorize the five basic tables above (¬, ∧, ∨, →, ↔), then practice building tables for two- and three-variable statements by hand. Check each one here, find the first column where your answer differs, and fix that rule. The practice quiz on this page is a good start.
How do you make a truth table from a Boolean expression?
Read AND as ∧ (or a product, AB), OR as ∨ (or a sum, A + B) and NOT as ¬ (or A′). List 2ⁿ rows of 0s and 1s, add a column for each part, and finish with the whole expression. In this generator you can type A′B + AB′ directly and choose 1/0 values.
How do you make a truth table for logic gates?
Write the circuit as an expression, one gate at a time: an AND gate feeding an OR gate with an inverted input C is (A AND B) OR NOT C. Each gate output becomes a sub-expression column, and the final column is the circuit output. NAND and NOR gates are available as operators.
How do you make truth tables in Excel?
Copy the table here with the Spreadsheet (TSV) button and paste it into Excel or Google Sheets. To build one with formulas instead, put TRUE/FALSE in the variable columns and use AND(), OR(), NOT() and XOR(). Excel has no IMPLIES function, so write p → q as =OR(NOT(A2),B2), which is false only when p is true and q is false.
How do you use a truth table to check an argument's conclusion?
Make a column for each premise and one for the conclusion. Look only at the rows where every premise is true. If the conclusion is true in all of them, the argument is valid; if any of those rows has a false conclusion, that row is a counterexample. The Argument check tab does this for you.
Related calculators
- Set calculator (unions and intersections follow the same rules as ∨ and ∧)
- Binary, decimal and hexadecimal converter
- Probability calculator
- Permutations and combinations calculator
- Modular arithmetic calculator
More fractions & numbers calculators
Related to This Article
More math articles
- How to Balance the Scales: Inequalities with Addition and Subtraction of Mixed Numbers
- Praxis Elementary Education Math Flashcards
- Selecting and Integrating Evidence
- Explicit Details
- Closing Cost Calculator for Home Buyers (Cash to Close)
- Dark money
- The Best Grade 6 ELA Practice Tests for Oklahoma Students
- MTEL Elementary Mathematics (68) Worksheets: FREE & Printable
- Full-Length 8th Grade Common Core Math Practice Test
- LSAT Reading Comprehension: Track Viewpoints Across a Passage (2027 Prep)



What people say about "Truth Table Generator: Steps, DNF/CNF & Equivalence"?
No one replied yet.