Skip to content

Truth table generator

Turn a small Boolean expression into every true/false row without executing the input as code.

Boolean expression

Processed in your browser.

Up to 6 variables. NOT > AND > XOR > OR > implication > equivalence. Example: (A AND B) -> C

Truth table

Enter a Boolean expression, then select Generate.

How to generate a truth table

  1. Enter one expression using variable names, constants 0/1 or TRUE/FALSE, supported operators, and parentheses.
  2. Use NOT or !, AND or &&, XOR or ^, OR or ||, implication ->, and equivalence <->. Unicode ¬ ∧ ⊕ ∨ → ↔ are also accepted.
  3. Select Generate. Variables appear in order of first occurrence and rows run from all false to all true.
  4. Review the classification and table, then Copy table for a tab-separated plain-text version. Editing the expression invalidates the previous table.

Parser, precedence, and row order

The page tokenizes and parses the expression directly; it never passes input to eval, Function, JavaScript, or a shell. Precedence is NOT first, then AND, XOR, OR, implication, and equivalence. Parentheses override precedence. Implication is right-associative, so A -> B -> C means A -> (B -> C).

For n distinct variables the generator creates 2ⁿ rows, capped at 64 because n is capped at 6. Variables keep their first-appearance order. Each row evaluates NOT as negation, AND as both true, XOR as exactly one true, OR as at least one true, implication as false only for true -> false, and equivalence as equal truth values.

Checked expressions

A -> B produces 1, 1, 0, 1 for rows 00, 01, 10, 11. A XOR B produces 0, 1, 1, 0 in the same order.

A OR NOT A is classified as a tautology. A AND NOT A is a contradiction. (A -> B) IFF (NOT A OR B) is a tautology because both sides match on every row.

Syntax and limits

  • Variable names start with an ASCII letter and may continue with ASCII letters, digits, or underscores. Names are case-sensitive: A and a are distinct variables.
  • The parser reports unsupported tokens, missing operands/operators, unbalanced parentheses, excessive length, and more than six variables. It does not guess or repair an ambiguous expression.
  • This is a small propositional-logic table generator. It does not simplify formulas, prove theorems, draw circuits, generate Karnaugh maps, accept quantifiers, or run arbitrary code.

Truth table FAQ

Why is the table limited to six variables?

Rows double for every variable; six variables already produce 64 rows and stay readable in a small browser tool.

Which operator binds most tightly?

NOT, then AND, XOR, OR, implication, and equivalence. Parentheses can make any grouping explicit.

How are variables ordered?

By their first appearance in the expression, with false rows before true rows.

What do the classifications mean?

A tautology is true on every row, a contradiction is false on every row, and a contingent expression has both results.