Home
Try:
Operators: AND (∧), OR (∨), NOT (¬), XOR (⊕), NAND (↑), NOR (↓), XNOR (⊙), IMPLIES (→ or ->), IFF (↔ or <->). Variables are single letters A–Z. Implicit AND is supported, so AB means A AND B. Up to 5 variables (32 rows) and up to 8 expressions per run.

What Is a Truth Table?

A truth table is a systematic way of listing every possible combination of truth values for the variables in a boolean expression, together with the resulting value of the expression for each combination. For an expression with n variables, there are 2n rows — one for each assignment of True (T) or False (F).

Truth tables are the standard tool for:

  • Verifying logical identities such as A → B ≡ ¬A ∨ B.
  • Checking logical equivalence between two expressions.
  • Classifying expressions as tautologies, contradictions or contingencies.
  • Designing digital circuits — the truth table is the starting point for a logic-gate implementation.
  • Teaching propositional logic — every row is a model of the expression's semantics.

Supported Operators

The generator accepts both word forms and the standard mathematical symbols. Operators are listed from highest to lowest precedence:

OperatorSymbols / wordsMeaningExample
NOT¬, ~, !, NOTNegation¬A
AND∧, &, &&, ANDConjunctionA ∧ B
NAND↑, NANDNegated conjunctionA ↑ B
XOR⊕, ^, XORExclusive orA ⊕ B
XNOR⊙, XNORNegated exclusive orA ⊙ B
OR∨, |, ||, ORDisjunctionA ∨ B
NOR↓, NORNegated disjunctionA ↓ B
IMPLIES→, ->, =>, IMPLIESImplicationA → B
IFF↔, <->, <=>, IFFBiconditionalA ↔ B

Constants may be written as 1 (True), 0 (False), TRUE or FALSE. Implicit AND is supported: AB is parsed as A AND B, and A(B ∨ C) is parsed as A AND (B OR C).

Operator Precedence and Associativity

When operators are mixed, precedence decides which binds more tightly: NOT binds first, then AND, then XOR, then OR, then IMPLIES, then IFF. Parentheses override this ordering.

Example: NOT A AND B is parsed as (NOT A) AND B, whereas NOT (A AND B) negates the entire conjunction.

IMPLIES is right-associative, so A → B → C is read as A → (B → C). All other binary operators are left-associative.

Tautologies, Contradictions and Contingencies

Every expression falls into exactly one of three categories:

  • Tautology — true in every row. Example: A ∨ ¬A.
  • Contradiction — false in every row. Example: A ∧ ¬A.
  • Contingency — true in some rows and false in others. Example: A ∧ B.

The generator labels each expression and reports the exact number of true and false rows. An expression is satisfiable if it is true in at least one row — that is, if it is not a contradiction.

Logical Equivalence

Two expressions are logically equivalent when they have the same truth value in every row of their truth tables. For example:

  • A → B ≡ ¬A ∨ B
  • A ↔ B ≡ (A ∧ B) ∨ (¬A ∧ ¬B)
  • ¬(A ∧ B) ≡ ¬A ∨ ¬B  (De Morgan)

When you enter more than one expression, the calculator compares their columns row by row and reports whether they are equivalent — and, if not, which pairs fail.

Special Operators: NAND, NOR and XNOR

These three operators are the negations of the basic ones and are extremely common in digital electronics:

  • NAND (↑): A ↑ B = ¬(A ∧ B)
  • NOR (↓): A ↓ B = ¬(A ∨ B)
  • XNOR (⊙): A ⊙ B = ¬(A ⊕ B) — equivalent to the biconditional A ↔ B.

NAND and NOR are functionally complete: any boolean function can be built from NAND gates alone, or from NOR gates alone.

How the Calculator Works

  • Tokenises each expression, accepting both symbolic and word forms, and inserting implicit AND between adjacent operands.
  • Parses the token stream into an expression tree using precedence climbing.
  • Collects all variables (single letters A–Z) and orders them alphabetically.
  • Generates 2n rows, with the first variable alternating slowest (standard MSB-first ordering).
  • Evaluates every sub-expression bottom-up via post-order traversal, producing one column per compound node.
  • Classifies each expression as a tautology, contradiction or contingency, and checks pairwise logical equivalence.

Supported Input Format

InputMeaningResult (excerpt)
A AND BConjunctionT only when A = T, B = T
A OR BDisjunctionF only when A = F, B = F
NOT ANegationopposite of A
A XOR BExclusive orT when A ≠ B
A -> BImplicationF only when A = T, B = F
A <-> BBiconditionalT when A = B
A NAND BNegated conjunctionF only when A = B = T
A ↓ BNegated disjunctionT only when A = B = F
A BImplicit ANDsame as A AND B
A; B; A XOR BBatch of expressionsseparate result columns

Assumptions and Limitations

  • Variables are single letters A–Z; multi-letter names are not supported.
  • Up to 5 variables (32 rows) and up to 8 expressions per run.
  • Expression lines may be separated by newlines or semicolons.
  • Angles, numbers and decimals are not boolean values here — use 1 or 0 for constants.
  • Every expression is evaluated exactly using classical two-valued boolean logic — no fuzzy or three-valued logic is supported.
  • Sub-expression columns are deduplicated within a single expression, but identical sub-expressions from different expressions appear separately.

Where Truth Tables Show Up

  • Digital circuit design — logic gates, multiplexers, adders, state machines.
  • Computer science — propositional logic, SAT solvers, formal verification.
  • Mathematics — proving logical identities and equivalences.
  • Philosophy — formal logic and the semantics of conditionals.
  • Electrical engineering — Boolean simplification, Karnaugh maps, PLA design.
  • Teaching — a hands-on way to internalise operator precedence and De Morgan's laws.

❓ Truth Table FAQ

What is a truth table?

A truth table lists every possible combination of truth values (True or False) for the variables in a boolean expression, together with the resulting value of the expression for each combination. A truth table with n variables has 2^n rows. It is the standard tool for verifying logical identities, checking logical equivalence, and designing digital circuits.

How do I generate a truth table for an expression?

Enter your boolean expression in the input area, using the operators AND, OR, NOT, XOR, NAND, NOR, XNOR, IMPLIES (→) and IFF (↔). The calculator detects all variables, creates one row for every combination of truth values (2^n rows for n variables), and evaluates the expression in each row. Intermediate sub-expressions are shown in their own columns so you can trace each step.

Which operators are supported?

The calculator accepts both word forms and symbols: NOT (¬, ~, !), AND (∧, &, &&), OR (∨, |, ||), XOR (⊕, ^), NAND (↑), NOR (↓), XNOR (⊙), IMPLIES (→, ->, =>) and IFF (↔, <->, <=>). The constants TRUE and FALSE may be written as 1 and 0. Variables are single letters A–Z. Implicit AND is supported, so AB is the same as A AND B.

How many variables can I use?

Up to 5 variables (32 rows). If you need more, split the expression into pieces or use a dedicated boolean-simplification tool. With 5 variables the table stays readable; larger tables become unwieldy very quickly.

What is the precedence of logical operators?

From highest to lowest: NOT (¬), then AND (∧), then XOR (⊕), then OR (∨), then IMPLIES (→), then IFF (↔). Parentheses override precedence. For example, NOT A AND B is read as (NOT A) AND B, while NOT (A AND B) negates the whole conjunction.

What is a tautology, contradiction and contingency?

A tautology is an expression that is true in every row of its truth table (for example, A OR NOT A). A contradiction is false in every row (A AND NOT A). A contingency is true in some rows and false in others (A AND B). The calculator labels each expression and reports the count of true and false rows.

What is logical equivalence?

Two expressions are logically equivalent when they have the same truth value in every row of their truth tables. For example, A IMPLIES B is equivalent to NOT A OR B. When you enter more than one expression, the calculator compares them row by row and reports whether they are equivalent.

Can I compare multiple expressions at once?

Yes. Enter up to 8 expressions, one per line (or separated by semicolons). Each expression gets its own final column in the truth table, and the analysis section reports the type, true-row count and logical equivalence of every pair.

What does the IMPLIES operator (→) mean?

A → B means "if A then B" and is false only when A is true and B is false. It is equivalent to NOT A OR B. The calculator uses this exact definition when evaluating the expression.

What does the IFF operator (↔) mean?

A ↔ B means "A if and only if B" — the biconditional. It is true when A and B have the same truth value and false otherwise. It is equivalent to (A AND B) OR (NOT A AND NOT B).

What are NAND, NOR and XNOR?

NAND (↑) is the negation of AND: A ↑ B = NOT (A AND B). NOR (↓) is the negation of OR: A ↓ B = NOT (A OR B). XNOR (⊙) is the negation of XOR: A ⊙ B = NOT (A XOR B), which is the same as the biconditional. All three are common in digital electronics.

Can I export the truth table?

Yes. Click "Copy as CSV" below the truth table to copy it to the clipboard in comma-separated format. You can then paste it into a spreadsheet, text editor or document.