The Magic Codex

Truth Table Generator

Type any logic expression and get its full truth table — every combination, the result column highlighted.

Single-letter variables (p, q, r…). Type the words AND OR NOT XOR IMPLIES IFF, or tap a button.

How to use the Truth Table Generator

  1. Type your expression — e.g. p AND (q OR r). Variables are single letters; the table updates as you type.
  2. Tap the operator buttons if you don't want to type the words — they insert the operator at your cursor.
  3. Read the highlighted column — that's your expression's value for every possible input combination.

Why truth tables matter

A truth table is the definition of a logical connective, written out. When two expressions give the same highlighted column, they're logically equivalent — that's how you prove De Morgan's laws, verify a proof step, or check whether a circuit design does what you meant. Programmers meet the same idea as boolean logic; philosophers as propositional logic; it's the same table either way.

IMPLIES: the one that trips everyone up

p → q is false only when p is true and q is false. "If it rains, I'll bring an umbrella" — a sunny day with no umbrella doesn't make the sentence a lie. That's why the (F, ·) rows are always true. It's the connective behind if-statements and mathematical proof by contradiction's less scary cousin.

What is a truth table?
A truth table lists every possible true/false combination for an expression's variables, and the expression's value for each one. Two variables give 4 rows, three give 8, four give 16 — which is why this tool covers up to 4 variables.
Which operators can I use?
Six operators: AND (∧), OR (∨), NOT (¬), XOR (⊕), IMPLIES (→), and IFF (↔). Type the words, tap the operator buttons above the input, or paste the symbols themselves — they all mean the same thing.
Why is the tool capped at 4 variables?
Each new variable doubles the table: 4 variables is 16 rows, but 5 would be 32 and 6 would be 64 — unreadable on a phone and rarely what a class assignment asks for. Split the expression or drop a variable to fit.
What does p IMPLIES q mean in logic?
'p IMPLIES q' (p → q) is false in exactly one case: when p is true and q is false. A false premise never breaks a promise — 'if it rains, I'll bring an umbrella' isn't a lie on a sunny day.
What order are the rows in?
The textbook layout: all-true first, with the first variable changing slowest — TT, TF, FT, FF for two variables. That's the ordering most courses expect.
Is my expression sent anywhere?
No. The parser and table builder run entirely in your browser with JavaScript. Nothing is uploaded, stored, or tracked.

Need help with this tool?

Found a bug, or have a suggestion for the codex? Write to us — a real human reads every message.

[email protected]

More from the codex