Skip to content
ToolBoxGeniehome

Truth Table Generator

Developer Tools · Added

A truth table is the one proof technique that needs no cleverness: try every combination and look. Type an expression in whichever notation you learned — programming operators, logic symbols or the word forms — and every case is enumerated, with a column for each piece of working along the way.

Operators: ! ~ NOT · & && AND · | || OR · ^ XOR · -> IMPLIES · <-> IFF. Brackets work as you would expect.

Enter a second expression to check whether the two are logically equivalent.

Try:

Truth table

Result

True in 3 of 8 cases

True in some cases and false in others, which is what a useful condition looks like.

Read as A ∧ (B ∨ ¬C) — the brackets are the parser's, showing how precedence grouped your input.

ABC¬C(B ∨ ¬C)A ∧ (B ∨ ¬C)
TTTFTT
TTFTTT
TFTFFF
TFFTTT
FTTFTF
FTFTTF
FFTFFF
FFFTTF

True on rows 0, 1, 3 counting from zero — the minterms, if you are heading towards a Karnaugh map.

Rows count down from all-true, which is the order textbooks print. Two operators are worth watching: ^ is exclusive-or here, as it is in C and JavaScript, not exponentiation; and + is OR, as it is in Boolean algebra, not addition. Implication surprises people most — A → B is false only when a true premise leads to a false conclusion, so every row with a false premise comes out true.

How to use the truth table generator

  1. 1Type your expression. Brackets, and the operators listed under the box, all work as you would expect.
  2. 2Read the classification: always true, always false, or true in some cases.
  3. 3Follow the intermediate columns to see how each row reached its answer.
  4. 4Enter a second expression in the comparison field to check whether the two are equivalent.

Examples

De Morgan's law

Input
!(A && B) compared with !A || !B
Result
Equivalent — the two agree on all four rows

Material implication

Input
A -> B
Result
False on one row only: A true, B false

Every row with a false premise comes out true, which is the part that surprises people.

About the truth table generator

Using it on real conditions

The everyday use is not homework. It is taking the condition out of an if statement that has grown three ands and a not, substituting single letters for the sub-expressions, and looking at what it actually does.

Two results are worth the trip on their own. A tautology means the branch always runs and the condition can go. A contradiction means the branch is dead code — and dead code that looks live is exactly the kind of thing that survives a review.

Why implication looks wrong at first

Material implication is false in one case only: a true premise leading to a false conclusion. Everything else is true, including every row where the premise is false. So 'if the moon is made of cheese then I am the king of Spain' is a true statement.

It reads as a trick until you see what the alternative would cost. A rule such as 'every number over 100 is positive' should not be falsified by the number 7, which the rule says nothing about. Making the false-premise rows true is what lets a general statement stay true for the cases outside its scope.

Frequently asked questions

Which notation does it accept?
All the common ones, mixed freely. NOT can be written !, ~, ¬ or the word; AND as &, &&, ∧, · or the word; OR as |, ||, ∨, + or the word; XOR as ^, ⊕ or the word; implication as -> or =>; equivalence as <-> or <=>. Somebody who learned this in a digital electronics class and somebody who learned it in a C course can both type what they already know.
Is ^ exclusive-or or a power?
Exclusive-or, as it is in C, Java, JavaScript and their relatives. Some maths texts use it for exponentiation, but exponentiation has no meaning in a boolean expression, so there is only one reading under which the whole thing makes sense. The same applies to + being OR rather than addition.
How does it decide what binds tightest?
NOT first, then AND, then XOR, then OR, then implication, then equivalence — the standard order in logic texts, and consistent with C for the operators they share. Where it matters, the result panel shows the expression written back with the parser's own brackets, so you can see exactly how your input was grouped rather than assuming.
Why does it stop at ten variables?
Ten variables produce 1,024 rows, which is already more table than anyone reads carefully. Eleven would be 2,048 and twelve 4,096 — the limit is where the table stops being useful to a person, not where the arithmetic gets slow.