DigitHelm
Discrete Math

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.

Instant Results100% FreeAny DeviceNo Sign-up

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. 1

    Type a Boolean expression using variables A, B, C, D (up to 4, giving up to 16 rows)

  2. 2

    Use && or AND for conjunction, || or OR for disjunction, ! or NOT for negation

  3. 3

    Use ^ or XOR, NAND, NOR, XNOR for compound operators

  4. 4

    Click a preset to load a classic example expression

  5. 5

    Click "Generate Truth Table" — TRUE rows are highlighted

  6. 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

OperatorSymbols acceptedOutput is 1 when…Gate symbol
AND&&, ANDBoth inputs are 1⋅ or ∧
OR||, ORAt least one input is 1+ or ∨
NOT!, NOTInput is 0¬ or ′
XOR^, XORExactly one input is 1
NANDNANDNot both inputs are 1 (NOT AND)
NORNORNeither input is 1 (NOT OR)
XNORXNORBoth inputs equal (exclusive-NOR)

Common Boolean Identities

IdentityExpressionLaw name
Double negation!!A = AInvolution
De Morgan's 1!(A&&B) = !A||!BDe Morgan
De Morgan's 2!(A||B) = !A&&!BDe Morgan
IdempotencyA&&A = A, A||A = AIdempotency
AbsorptionA&&(A||B) = AAbsorption
DistributiveA&&(B||C) = (A&&B)||(A&&C)Distributive
TautologyA||!A = 1Excluded Middle
ContradictionA&&!A = 0Non-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

Boolean Algebra Calculator
Evaluate Boolean expressions with AND, OR, NOT, XOR, NAND, NOR, XNOR, implication, and biconditional. Generates truth tables for up to 4 variables with SOP, POS canonical forms, Σm/ΠM notation, and equivalence checking.
Set Theory Calculator | Union, Intersection, Complement & Venn Diagram
Define up to three sets A, B, C with any elements and compute all standard set operations: union, intersection, difference, symmetric difference, complement, Cartesian product, and power set. Displays a membership table, text Venn diagram, cardinality, and subset relationships.
Advanced Combinatorics | Derangements, Bell, Catalan & Stirling Numbers
Compute advanced counting numbers in one place: derangements D(n), Bell numbers B(n), Catalan numbers C(n), Stirling numbers of the second kind S(n,k), multinomial coefficients, and stars-and-bars distributions. Each result includes the definition, step-by-step working, and a real-world application.
Number Base Arithmetic | Add, Subtract, Multiply & Divide in Any Base
Perform addition, subtraction, multiplication, and division directly in any number base from 2 to 16 without first converting to decimal. Shows full carry and borrow steps column by column exactly as done by hand, with decimal cross-verification and support for binary, octal, and hexadecimal.
Binary Arithmetic Calculator
Add, subtract, multiply, and divide binary numbers with long-form carry/borrow visualization, column-by-column step table, multi-base output, and overflow detection.

Explore 360+ Free Calculators

From math and science to finance and everyday life — all free, no account needed.