Skip to content

Truth Table Generator

Generate a truth table from a boolean logic expression.

Calculated locally in your browser.

Use single-letter variables and NOT / AND / OR / XOR (or ! & | ^).

How do you generate a truth table from a boolean expression?

For n variables there are 2ⁿ rows, one for each combination of inputs. Operator precedence is NOT, then AND, then XOR, then OR, with parentheses overriding it; 1 means true and 0 means false. A truth table lists every input combination and the resulting output, the definitive way to check whether two expressions are equivalent. A AND B is true only when both are 1.

Understanding your result

A truth table lists every possible combination of input values and the resulting output of the expression. It is the definitive way to check whether two logic expressions are equivalent.

Formula and method

For n variables there are 2ⁿ rows. Operator precedence is NOT, then AND, then XOR, then OR; parentheses override it. 1 means true and 0 means false.

Worked example

A AND B is true only in the single row where both A and B are 1.

How to use this tool

  1. Enter a boolean expression.
  2. Use single-letter variables and logic operators.
  3. Read the truth table for all combinations.

Common mistakes to avoid

  • Using multi-letter variable names — use single letters.
  • Forgetting an operator between two variables (write A AND B, not A B).

About the Truth Table Generator

The Truth Table Generator builds the complete truth table for a boolean expression. Enter a formula using AND, OR, NOT and XOR with single-letter variables, and see the result for every combination of inputs.

Who should use this tool

Computer-science and electronics students, and developers working with boolean logic.

Benefits

  • Every input combination evaluated.
  • Words or symbols for operators.
  • Supports up to six variables.
  • Counts how often the expression is true.

Practical use cases

  • Checking a logic-gate design.
  • Simplifying a boolean expression.
  • Studying for a discrete-maths exam.

Explore all Developer Tools tools

Frequently asked questions

Which operators are supported?

NOT, AND, OR and XOR — as words or the symbols !, &, | and ^. Parentheses group sub-expressions.

How many variables can I use?

Up to six, which produces a 64-row table. More than that becomes unwieldy to read.

Share this tool

Free to use — copy the link, share it anywhere, or add the tool to your own website.

Embed this tool on your site (free)

Copy this code and paste it into any web page — it stays free and always up to date: