Truth Table Generator | Boolean Expression Evaluator
Generate complete truth tables for any Boolean expression with up to 4 variables. Supports AND, OR, NOT, XOR, NAND, NOR, and XNOR operators. Automatically identifies tautologies, contradictions, and contingencies, and derives the canonical DNF and CNF forms with minterm and maxterm listings.
Operators: AND, OR, NOT, XOR, NAND, NOR, XNOR | Symbols: && || ! | Variables: A B C D
What Is the Truth Table Generator | Boolean Expression Evaluator?
A truth table lists every possible combination of TRUE/FALSE inputs for a Boolean expression and shows the output for each. With n variables there are 2ⁿ rows. The table is the canonical description of any combinational logic function: two expressions are logically equivalent if and only if their truth tables are identical. DNF (Disjunctive Normal Form) is the OR of all minterms — rows where output is 1. CNF (Conjunctive Normal Form) is the AND of all maxterms — rows where output is 0. A tautology is always true (like A || !A); a contradiction is always false (like A && !A); all other expressions are contingencies.
Formula
f(A, B, C, …) evaluated over all 2ⁿ combinations — with DNF, CNF, and tautology/contradiction detection
How to Use
- 1
Type a Boolean expression using variables A, B, C, D (up to 4, giving up to 16 rows)
- 2
Use && or AND for conjunction, || or OR for disjunction, ! or NOT for negation
- 3
Use ^ or XOR, NAND, NOR, XNOR for compound operators
- 4
Click a preset to load a classic example expression
- 5
Click "Generate Truth Table" — TRUE rows are highlighted
- 6
Read the classification (tautology / contradiction / contingency) and DNF/CNF output below the table
Type a Boolean expression using A–D as variables and the operators below, then click Generate Table to see every row.
Example Calculation
Expression: (A && B) || (!A && C) — 3 variables, 8 rows. Row 3 (A=0, B=1, C=1): !A=1, so !A&&C=1, output=1. Row 6 (A=1, B=1, C=0): A&&B=1, output=1. DNF = (A∧B) ∨ (¬A∧C). Verify with De Morgan: ¬((¬A∨¬B) ∧ (A∨¬C)) simplifies to the same minterms.
Understanding Truth Table Generator | Boolean Expression Evaluator
Boolean Operator Quick Reference
| Operator | Symbols accepted | Output is 1 when… | Gate symbol |
|---|---|---|---|
| AND | &&, AND | Both inputs are 1 | ⋅ or ∧ |
| OR | ||, OR | At least one input is 1 | + or ∨ |
| NOT | !, NOT | Input is 0 | ¬ or ′ |
| XOR | ^, XOR | Exactly one input is 1 | ⊕ |
| NAND | NAND | Not both inputs are 1 (NOT AND) | ⊼ |
| NOR | NOR | Neither input is 1 (NOT OR) | ⊽ |
| XNOR | XNOR | Both inputs equal (exclusive-NOR) | ⊙ |
Common Boolean Identities
| Identity | Expression | Law name |
|---|---|---|
| Double negation | !!A = A | Involution |
| De Morgan's 1 | !(A&&B) = !A||!B | De Morgan |
| De Morgan's 2 | !(A||B) = !A&&!B | De Morgan |
| Idempotency | A&&A = A, A||A = A | Idempotency |
| Absorption | A&&(A||B) = A | Absorption |
| Distributive | A&&(B||C) = (A&&B)||(A&&C) | Distributive |
| Tautology | A||!A = 1 | Excluded Middle |
| Contradiction | A&&!A = 0 | Non-Contradiction |
Where Truth Tables Are Used
- ›Digital circuit design — verifying that a logic gate network produces the right outputs
- ›Propositional logic proofs — checking validity of arguments in philosophy and mathematics
- ›Programming conditions — reasoning about complex if/else branches and short-circuit evaluation
- ›Database query optimization — analysing WHERE clause predicates
- ›Cryptography — Boolean functions over GF(2) underpin stream ciphers and hash functions
Frequently Asked Questions
How many variables does this support?
Up to 4 variables (A, B, C, D), giving a table of up to 16 rows.
What is DNF?
Disjunctive Normal Form is the OR of all minterms — rows where the output is 1. Each minterm ANDs all variables, negating those that are 0 in that row.
What is a tautology?
A Boolean expression that is TRUE for every input combination. Example: A || !A is always true regardless of A. Useful for proving logical equivalences.
Can I use XOR and NAND?
Yes. Use ^ or XOR for exclusive-OR (true when exactly one input differs), NAND for NOT-AND, NOR for NOT-OR, and XNOR for exclusive-NOR (true when both inputs match).
What is the difference between CNF and DNF?
DNF is an OR of ANDs (sum of products) built from rows where output is 1. CNF is an AND of ORs (product of sums) built from rows where output is 0. Both forms represent the same function.
You Might Also Like
Explore 360+ Free Calculators
From math and science to finance and everyday life — all free, no account needed.