Truth table generator

Write an expression such as (A or B) and not C, using words or symbols, and get every row of its truth table. Switch to 1/0 values, or show a column for each sub-expression.

Values
Columns

Contingent: true in 2 of 4 rows.

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Type or paste the expression.
  2. Choose T/F or 1/0 and whether to show only the result column or every sub-expression.
  3. Copy the table. The line under it says if the expression is a tautology, a contradiction or neither.

How it works

The expression is parsed into a tree with the precedence rules above, then evaluated once for each of the 2ⁿ combinations of its n variables. Operators are shown in their standard symbols in the column headings, so “not A and B” appears as ¬A ∧ B.

Worked example

p -> q (if p then q) with 1/0 values:

  • p = 0, q = 0 gives 1
  • p = 0, q = 1 gives 1
  • p = 1, q = 0 gives 0
  • p = 1, q = 1 gives 1

An implication is false only when the premise is true and the conclusion is false.

Tips

  • Use the step columns to check a long formula part by part.
  • To test two formulas for equivalence, join them with iff; a tautology means they always agree.
  • De Morgan’s law: not (A and B) gives the same table as (not A) or (not B).

Frequently asked questions

Which operators can I use?

NOT (not, !, ~, ¬), AND (and, &, &&, ∧), OR (or, |, ||, ∨, +), XOR (xor, ^, ⊕), NAND, NOR, XNOR, implication (->, =>, →, implies) and equivalence (<->, <=>, ↔, iff). The constants are true, false, 1 and 0.

What is the order of operations?

From strongest to weakest: NOT, then AND/NAND, then XOR/XNOR, then OR/NOR, then implication, then equivalence. Implication groups right to left, so a -> b -> c means a -> (b -> c). Use brackets whenever you want to be sure.

What is a tautology?

An expression that is true for every combination of inputs, such as A or not A. A contradiction is false for every combination, such as A and not A. Anything else is contingent. The line under the table tells you which one yours is.

How are the rows ordered?

Variables are taken in the order they first appear. With T/F the table starts with every variable true, as in most textbooks. With 1/0 it counts up in binary from all zeros.

How many variables can I use?

Up to 8, which gives 256 rows. A variable is a letter or word that is not an operator, so p, q, rain and X1 are all fine.

More in Math

All tools in this category: Math ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.