Logical Equivalence Checker with Truth Tables

Compare two propositional formulas on every truth-value assignment. The checker proves equivalence when both result columns match throughout, or highlights the assignments that disprove it. Everything runs privately in your browser.

Enter two propositions

Use up to 8 distinct variables across both formulas. Names such as P, rain, and road_wet are accepted.

Private by design: both formulas are parsed and evaluated on this device. They are not uploaded, stored, or placed in the page URL.

Equivalence result

The example formulas are ready to compare.

Your verdict and comparison truth table will appear here.
Press Check equivalence or use Ctrl/⌘ + Enter.

Advertisement

Accepted propositional logic syntax

OperationAccepted inputPrecedence
NOT!P, ~P, ¬P, P', not P1 (highest)
ANDP & Q, P * Q, P ∧ Q, P and Q2
XORP ^ Q, P ⊕ Q, P xor Q3
ORP | Q, P + Q, P ∨ Q, P or Q4
ImplicationP -> Q, P => Q, P → Q, P implies Q5
BiconditionalP <-> Q, P <=> Q, P ↔ Q, P iff Q6 (lowest)

Constants 0, 1, false, and true are accepted. Adjacent expressions imply AND: P Q means P ∧ Q, while PQ is one variable name. Parentheses override precedence; implication groups from right to left.

How truth tables test logical equivalence

1. Parse both formulas

The checker applies the displayed precedence rules and turns each proposition into a syntax tree. It reports formula-specific syntax errors with character positions.

2. Combine the variables

Variables from Formula A and Formula B form one ordered union. With n distinct variables, the complete comparison has 2n assignments.

3. Compare every row

Both formulas are evaluated under the same assignment. Matching output values support equivalence; a row with different outputs is a counterexample.

4. Reach the verdict

The formulas are equivalent exactly when there are zero counterexamples. A single mismatch is sufficient to prove they are not logically equivalent.

In symbols, A ≡ B exactly when v(A) = v(B) for every valuation v. Equivalently, the biconditional A ↔ B must be a tautology.

Limits and assumptions: this checker uses classical two-valued propositional logic. It supports up to 8 combined variables, 500 characters per formula, and 220 tokens per formula. Predicate logic, quantifiers, modal operators, and three-valued logics are outside its scope.

Definitions and the row-by-row comparison method follow OpenStax’s treatment of equivalent statements.

Editorial review: operator truth functions, parser precedence, shared-variable enumeration, constants, and representative equivalence laws checked by the Starlight Tools editorial team. Last reviewed: .

Worked logical equivalence example

Compare P → Q with ¬P ∨ Q. If P is false, both formulas are true. If P is true, both formulas have the same value as Q. Their outputs therefore match on all four assignments.

The comparison table contains no counterexample, so P → Q ≡ ¬P ∨ Q. By contrast, P ∨ Q and P ∧ Q differ when exactly one variable is true; either such row disproves equivalence.

When formulas use different variable sets, every combined assignment still matters. For example, P is not equivalent to P ∨ Q because P = false, Q = true is a counterexample.

Logical equivalence checker FAQ

What does logically equivalent mean?

Two propositions are logically equivalent if they have the same truth value for every assignment of all variables occurring in either formula. Equivalent formulas can look different syntactically.

Is one matching truth-table row enough?

No. Equivalence requires a match on every possible assignment. However, one mismatching row is enough to prove non-equivalence because it supplies a counterexample.

Can the two formulas contain different variables?

Yes. The checker uses the union of variables from both formulas. A variable absent from one formula can still affect the other formula and therefore the equivalence verdict.

Is checking A ↔ B for a tautology the same test?

Yes. Formula A and Formula B are equivalent precisely when their biconditional is true on every assignment. The checker displays the two result columns and their row-by-row match directly.

Does the order of variables affect the answer?

No. Variable order changes only the order of truth-table rows. It cannot change whether the two formulas match on every assignment.

Can I compare tautologies or contradictions?

Yes. Two tautologies are equivalent to each other, as are two contradictions. A tautology is not equivalent to a contradiction or to a contingency.

What happens if I enter only constants?

The checker evaluates the single empty assignment. For example, true and 1 are equivalent, while true and false are not.

Does the checker store my formulas?

No. Parsing, truth-table evaluation, copying, and CSV creation happen locally in your browser. The tool does not transmit or save the entered formulas.

Explore more tools