All Tools
T

Truth Table Generator

Generate full truth tables for classical two-valued propositional logic formulas, with deterministic row ordering and visible intermediate columns.

Accepted syntax

NOT: `¬`, `~`, `!`, `not`

AND: `∧`, `&`, `&&`, `and`

OR: `∨`, `v`, `||`, `or`

XOR: `⊕`, `xor`, `^`

IMPLIES: `→`, `->`, `=>`

IFF: `↔`, `<->`, `<=>`

Precedence is parentheses > NOT > AND > OR/XOR > IMPLIES > IFF. Chained implications associate right to left, so `p -> q -> r` means `p -> (q -> r)`. OR is inclusive OR. When you mix OR and XOR, or combine several binary operators, use parentheses to make grouping explicit.

Enter one propositional formula to generate the full table. The tool uses classical two-valued propositional logic and computes every row in the browser.

Truth Table Generator for Propositional Logic

This truth table generator builds the full table for one propositional formula at a time. It uses classical two-valued propositional logic in the browser, so every variable is either true or false and nothing is sent to a server.

You can type symbolic logic like ¬(p ∧ q) or developer-style input like !isAdmin && featureFlag. The parser accepts explicit aliases, normalizes them into one AST, and then evaluates every row in deterministic order.

Accepted operators

OR is inclusive OR. XOR is separate and is true only when exactly one side is true.

Precedence and grouping

The tool uses this precedence order:

  1. parentheses
  2. NOT
  3. AND
  4. OR and XOR
  5. IMPLIES
  6. IFF

Operators on the same level evaluate left to right, except implication chains, which associate right to left. That means p -> q -> r is parsed as p -> (q -> r), not ((p -> q) -> r). Parentheses are still recommended whenever a formula could be read more than one way.

What the extra columns mean

The table shows:

Those intermediate columns make it easier to trace formulas like featureFlag && !isAdmin because you can see the value of !isAdmin before it is combined with the left side.

Implication, biconditional, and XOR

p -> q is false only when p is true and q is false. That is the standard material implication rule used in classical logic and discrete math.

p <-> q is true exactly when both sides match.

p xor q is true exactly when the two sides differ.

Row ordering and variable ordering

Variables are extracted from the parsed AST, deduplicated, and sorted alphabetically with case-sensitive ordering. The leftmost variable toggles slowest and the rightmost variable toggles fastest, which matches the standard classroom truth-table pattern.

That means equivalent inputs like q & p, p and q, and (p)&&(q) still render variable columns in a stable order: p, then q.

Why the tool is capped at 8 variables

Full truth tables grow as 2^n rows. With 8 variables you already get 256 rows. That is still usable in a browser with horizontal scrolling, but higher counts get large fast and make the table much harder to scan.

This v1 tool rejects formulas with more than 8 distinct variables instead of partially rendering or freezing the page.

Troubleshooting

I typed p q and got an error — identifiers and groups must be joined by an explicit operator. Use p and q, p or q, p -> q, and so on.

My parentheses look fine but the tool says they are unbalanced — check for missing closing parentheses around nested implication or biconditional groups. The parser requires every ( to have a matching ).

I used |, =, or != and the tool rejected it — those aliases are intentionally unsupported in v1 because they are easy to confuse with programming or equality syntax. Use || or or for OR, <-> for biconditional, and xor for exclusive OR.

I expected OR to behave like XOR — OR here is inclusive OR, so p or q is true when both sides are true. Use xor if you want exactly one side to be true.

The table disappeared while I was typing — invalid input clears the computed output immediately so stale data is never shown for a malformed formula.