By Muhammad Tayyab (MSc Mathematics, Subject Specialist) · Last updated: · Reviewed for accuracy
What is a truth table?
A truth table lists every possible combination of true (T) and false (F) values for the variables in a logical expression, together with the result of the expression for each combination. With \(n\) variables the table has \(2^n\) rows. Truth tables are the standard tool in propositional logic, discrete mathematics, computer science and digital electronics for analysing Boolean expressions, proving logical equivalences and deciding whether a statement is always true, always false, or depends on its inputs.
This free truth table calculator takes any expression built from the variables A to E, the operators NOT, AND, OR, XOR, IMPLIES and IFF, and parentheses. It shows every intermediate sub-expression column, highlights the final result, and classifies the expression as a tautology, a contradiction, or contingent. It runs entirely in your browser, so nothing you type is sent to a server.
How to use this truth table generator
- Type your expression using variables A–E, for example
(A ∧ B) ∨ ¬C. Words work too:(A AND B) OR NOT C. - Use the operator buttons to insert ¬, ∧, ∨, ⊕, →, ↔ and parentheses, or click a preset example.
- Press “Generate Truth Table” (or hit Enter). The calculator builds all \(2^n\) rows.
- Read the verdict. The result box states whether the expression is a tautology, contradiction or contingent, and how many rows are true.
Keyboard shortcuts accepted: ~ or ! for NOT, & or && for AND, | or || for OR, ^ for XOR, -> or => for IMPLIES, and <-> or <=> for IFF.
Supported operators and precedence
| Operator | Symbols | Meaning | Truth rule |
|---|---|---|---|
| NOT | \( \neg \), \( \sim \), \( ! \) | Negation | \( T \to F \), \( F \to T \) |
| AND | \( \land \), &, && | Conjunction | \( T \) only if both true |
| OR | \( \lor \), |, || | Disjunction | \( F \) only if both false |
| XOR | \( \oplus \), ^ | Exclusive or | \( T \) if exactly one true |
| IMPLIES | \( \to \), ->, => | Conditional | \( F \) only if \( T \to F \) |
| IFF | \( \leftrightarrow \), <->, <=> | Biconditional | \( T \) if both match |
Operator precedence (highest to lowest): NOT (\( \neg \)), then AND (\( \land \)), then OR (\( \lor \)) and XOR (\( \oplus \)), then IMPLIES (\( \to \)), then IFF (\( \leftrightarrow \)). Use parentheses to override. IMPLIES is right-associative, so \( A \to B \to C \) means \( A \to (B \to C) \).
Basic truth tables: AND, OR, NOT, XOR, IMPLIES, IFF
The table below combines the truth tables of all six operators for two variables \(A\) and \(B\).
| A | B | \( \neg A \) | \( A \land B \) | \( A \lor B \) | \( A \oplus B \) | \( A \to B \) | \( A \leftrightarrow B \) |
|---|---|---|---|---|---|---|---|
| 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 |
How to make a truth table by hand
- Count the variables \(n\). The table needs \(2^n\) rows.
- Fill the variable columns. The rightmost variable alternates T, F, T, F…; the one to its left alternates every 2 rows; the next every 4 rows, and so on.
- Add a column for each sub-expression, starting with the innermost parentheses and the NOT operators, then AND, then OR/XOR, then IMPLIES and IFF.
- Evaluate row by row using the operator rules above.
- Read the final column. All T means tautology, all F means contradiction, a mix means contingent.
Tautology, contradiction and contingent expressions
| Type | Final column | Example | Meaning |
|---|---|---|---|
| Tautology | All T | \( A \lor \neg A \) | Always true (law of excluded middle) |
| Contradiction | All F | \( A \land \neg A \) | Always false (law of non-contradiction) |
| Contingent | Mix of T and F | \( A \land B \) | Depends on the variables |
Important logical equivalences you can test
Paste any of these as left ↔ right into the calculator. If the verdict is tautology, the two sides are logically equivalent.
| Law | Equivalence |
|---|---|
| De Morgan (AND) | \( \neg(A \land B) \equiv \neg A \lor \neg B \) |
| De Morgan (OR) | \( \neg(A \lor B) \equiv \neg A \land \neg B \) |
| Material implication | \( A \to B \equiv \neg A \lor B \) |
| Contrapositive | \( A \to B \equiv \neg B \to \neg A \) |
| Biconditional | \( A \leftrightarrow B \equiv (A \to B) \land (B \to A) \) |
| Double negation | \( \neg\neg A \equiv A \) |
| Distributive | \( A \land (B \lor C) \equiv (A \land B) \lor (A \land C) \) |
| Absorption | \( A \lor (A \land B) \equiv A \) |
| XOR definition | \( A \oplus B \equiv (A \lor B) \land \neg(A \land B) \) |
Worked examples
Example 1: \( (A \land B) \lor \neg C \) — contingent
- Three variables → \( 2^3 = 8 \) rows.
- Intermediate columns: \( A \land B \), \( \neg C \), and the final \( (A \land B) \lor \neg C \).
- The final column is \( T \) in some rows and \( F \) in others → contingent.
- A classic three-variable expression that appears in Karnaugh map problems.
Example 2: \( A \lor \neg A \) — tautology
- One variable → 2 rows.
- Intermediate columns: \( \neg A \), then \( A \lor \neg A \).
- The final column is \( T \) in every row → tautology (the law of excluded middle).
Example 3: \( A \land \neg A \) — contradiction
- One variable → 2 rows.
- Intermediate columns: \( \neg A \), then \( A \land \neg A \).
- The final column is \( F \) in every row → contradiction (the law of non-contradiction).
Example 4: \( (A \to B) \leftrightarrow (\neg A \lor B) \) — tautology
- Two variables → 4 rows.
- This is the material implication equivalence. Both sides evaluate identically in every row.
- The final column is \( T \) everywhere → tautology.
- It shows that \( A \to B \) can be rewritten as \( \neg A \lor B \).
Example 5: \( A \oplus B \oplus C \) — parity function
- Three variables → 8 rows.
- XOR is associative, so the result is \( T \) when an odd number of the three variables are true.
- Four of the eight rows give \( T \), four give \( F \) → contingent.
- This is the Boolean parity function, used in error checking and cryptography.
Common mistakes to avoid
- Forgetting parentheses when precedence matters. \( A \land B \lor C \) parses as \( (A \land B) \lor C \) because AND binds tighter than OR. If you mean \( A \land (B \lor C) \), write the parentheses.
- Assuming IMPLIES is symmetric. \( A \to B \) and \( B \to A \) are different expressions. Implication is not commutative.
- Mixing up IFF and XOR. IFF (\( \leftrightarrow \)) is true when both values match; XOR (\( \oplus \)) is true when they differ. They are exact opposites.
- Forgetting that a false premise makes an implication true. \( F \to \text{anything} \) is \( T \). Implication fails only when the premise is true and the conclusion is false.
- Counting rows wrong. \( n \) variables always give \( 2^n \) rows: 4 variables = 16 rows, 5 = 32, 6 = 64.
- Mixing notation styles. The parser accepts \( \neg \), \( \sim \) and \( ! \) together, but one consistent style is easier for readers to follow.
FAQ
What is a truth table?
A truth table lists every possible combination of truth values (true or false) for the variables in a logical expression, together with the resulting value of the expression for each combination. With \( n \) variables the table has \( 2^n \) rows. Truth tables are used to analyse Boolean logic expressions, verify logical equivalences, and determine whether an expression is a tautology, contradiction, or contingent.
How do I make a truth table?
List the distinct variables, write all \( 2^n \) combinations of T and F in standard order, add a column for each sub-expression working from the innermost parentheses outward, and finish with a column for the whole expression. This calculator does all of those steps automatically and shows every intermediate column.
What operators does this tool support?
NOT (\( \neg \), \( \sim \) or \( ! \)), AND (\( \land \), & or &&), OR (\( \lor \), | or ||), XOR (\( \oplus \) or ^), IMPLIES (\( \to \), -> or =>), IFF / biconditional (\( \leftrightarrow \), <-> or <=>), and parentheses. You can also type the words AND, OR, NOT, XOR, IMPLIES and IFF, and mix styles in one expression.
What is the difference between a tautology, contradiction, and contingent expression?
A tautology is true in every row, for example \( A \lor \neg A \). A contradiction is false in every row, for example \( A \land \neg A \). A contingent expression is true in some rows and false in others, for example \( A \land B \). The calculator labels every expression with one of these three verdicts.
What is the order of precedence for logical operators?
From highest to lowest: NOT, then AND, then OR and XOR, then IMPLIES, then IFF. Use parentheses to override the default order. For example, \( A \land B \lor C \) is read as \( (A \land B) \lor C \).
How are variables ordered in the table?
Variables are ordered alphabetically from left to right. The rightmost variable alternates T/F fastest, the one before it every two rows, and so on, starting with all variables true. This is the standard convention that produces the canonical \( 2^n \) row ordering.
Why is there a limit of five variables?
With \( n \) variables the table has \( 2^n \) rows. Five variables give 32 rows, which is still readable; six would give 64 and ten would give 1,024. The calculator caps the expression at five distinct variables (A to E) to keep the output useful. Most textbook problems use two or three.
Can I use this to check logical equivalences?
Yes. Two expressions are logically equivalent if their truth tables have the same final column. A quicker method is to join them with the biconditional, for example \( (A \to B) \leftrightarrow (\neg A \lor B) \). If the verdict is tautology, the two expressions are equivalent.
Is the truth table calculator free?
Yes. It is completely free, needs no sign-up and runs in your browser, so the expressions you type are not sent to a server.
Related tools
More from Hira Science Academy
Build the maths foundations behind logic and algebra with our Class 9 notes and Class 10 notes, and track term progress with the free Student Portal.