Home / All calculators / Truth Table Generator

Mathematics · Free online calculator

Truth Table Generator

Enter a propositional-logic expression. The generator parses a documented subset of Boolean syntax, orders variables alphabetically and evaluates every assignment without executing the input as code.

Calculator

Example: p -> q. Operators, precedence and limits are listed below.

Enter values and calculate.

Formula and method

For n distinct variables, the table has 2n rows. Each row is one truth assignment; the expression is evaluated with Boolean truth functions. Material implication A → B is false only when A is true and B is false. Equivalence A ↔ B is true when both truth values agree.

The calculator uses the entered values and displays the result in the browser. It does not send your calculation inputs to a server.

Worked example

For p → q, ordered assignments (p, q) = (F,F), (F,T), (T,F), (T,T) produce outputs T, T, F, T. The statement is contingent because it is true for some assignments and false for another.

Scope and limitations

Supported variables begin with A–Z and may contain digits or underscores; names are case-insensitive. Constants: true, false. Operators: NOT (!, ~, NOT), AND (&, &&, AND), XOR (^, XOR), inclusive OR (|, ||, OR), implication (->, =>, IMPLIES), equivalence (<->, <=>, IFF), and parentheses. Precedence from highest to lowest: NOT, AND, XOR, OR, implication (right-associative), equivalence. Limits: 200 characters, 128 tokens, nesting depth 64 and 10 distinct variables (1,024 rows). This is a propositional-logic table generator, not a theorem prover.

Frequently asked questions

How are variables ordered?

Variables are case-insensitive and displayed alphabetically, making row order stable.

What does “contingent” mean?

The expression is true on at least one row and false on at least one other row.

Can I enter programming code?

No. Only the listed symbols, variable names, constants and parentheses are parsed. The input is never evaluated as JavaScript.

References

These educational sources support the mathematical method described on this page.

  1. Millersville University — Truth Tables
  2. Kansas State University — Logic and Truth Tables

Related calculators

Scientific Calculator · Quadratic Equation Solver · All calculators

Friendly Calculator provides general educational tools. Check the method and assumptions before relying on any result.