1. Parse the formula
The generator turns variables, constants, parentheses, and connectives into a syntax tree. Clear position-aware messages identify missing operands, unmatched parentheses, and unsupported characters.
Use letters or names such as P, Q, rain, and wet. Parentheses are supported. Maximum: 10 variables and 500 characters.
Private by design: the formula is parsed and evaluated on this device. It is not uploaded or saved by the tool.
Your complete truth table will appear here.
Press Generate truth table or use Ctrl/⌘ + Enter.
| Operation | Accepted input | When it is true | Precedence |
|---|---|---|---|
| NOT | !P, ~P, ¬P, not P | When P is false | 1 (highest) |
| AND | P & Q, P && Q, P ∧ Q, P and Q | When both operands are true | 2 |
| XOR | P ^ Q, P ⊕ Q, P xor Q | When exactly one operand is true | 3 |
| OR | P | Q, P || Q, P ∨ Q, P or Q | When at least one operand is true | 4 |
| Implication | P -> Q, P => Q, P → Q, P implies Q | Except when P is true and Q is false | 5 |
| Biconditional | P <-> Q, P <=> Q, P ↔ Q, P iff Q | When both operands match | 6 (lowest) |
Constants true, false, 1, and 0 are also accepted. Implication groups from right to left; use parentheses whenever you want to make a grouping explicit.
The generator turns variables, constants, parentheses, and connectives into a syntax tree. Clear position-aware messages identify missing operands, unmatched parentheses, and unsupported characters.
With n distinct variables there are 2n assignments. Each variable alternates at half the frequency of the variable to its right, producing every combination exactly once.
Each connective is evaluated from its operands. The table includes connective nodes in inside-out order, so you can follow the same intermediate steps used to reach the final column.
All true means tautology; all false means contradiction; a mixture means contingency. True and false row counts are shown above the table.
Limits and assumptions: variable names begin with a letter and may contain letters, digits, or underscores. Keywords are case-insensitive. The 10-variable limit caps output at 1,024 rows, keeping table generation and export practical on phones. This is classical two-valued propositional logic; predicates, quantifiers, and three-valued logics are outside the tool’s scope.
Definitions and truth functions follow OpenStax’s standard treatments of constructing truth tables and conditional and biconditional truth tables.
Editorial review: Parser precedence, connective definitions, classifications, and example outputs checked by the Starlight Tools editorial team. Last reviewed: .
An implication is false only for P = true and Q = false. A false antecedent makes the implication true, so both rows beginning with P = false evaluate to true.
¬(P ∧ Q) ↔ (¬P ∨ ¬Q) is true on all four assignments. The generator therefore classifies the biconditional as a tautology. Its intermediate columns also show that the left and right sides always match.
P ⊕ Q is true when exactly one of P and Q is true. It differs from inclusive OR, which is also true when both operands are true.
P ∨ Q ∧ R is interpreted as P ∨ (Q ∧ R) because AND has higher precedence than OR. Write (P ∨ Q) ∧ R when the OR should be evaluated first.
A truth table lists every possible truth-value assignment for a formula’s variables and shows the formula’s value for each assignment. Intermediate columns reveal how compound propositions are evaluated.
A formula with n distinct propositional variables has 2n assignments. Two variables produce 4 rows, three produce 8, and ten produce 1,024.
P → Q is false only when P is true and Q is false. It is equivalent to ¬P ∨ Q.
A tautology is true under every assignment. A contradiction is false under every assignment. A contingency has at least one true row and at least one false row.
Yes. Names such as rain, road_wet, and alarm2 work. The reserved words not, and, xor, or, implies, iff, true, and false act as operators or constants.
Yes. The order is NOT, AND, XOR, OR, implication, then biconditional. Parentheses override precedence. Chained implication groups from right to left, so P → Q → R means P → (Q → R).
Yes. Copy table produces tab-separated text suitable for spreadsheets and notes. Download CSV creates a UTF-8 CSV file containing the variables and every intermediate column.
No. Formula parsing, evaluation, copying, and CSV creation happen locally in your browser. The tool does not transmit or save your entered formula.