Truth table generator for several logic expressions at once

Type one or more logic expressions, one per line, and get a single truth table with a column for each, plus a summary saying which are tautologies, contradictions or true in some rows.

Live demo · real result from this tool
Each line becomes a result column.
Show values as

Truth table (4 rows)

ABA AND BA OR BA XOR BNOT (A AND B)A -> B
0000011
0101111
1001110
1111001

Summary

  1. A AND B: true in 1 of 4 rows
  2. A OR B: true in 3 of 4 rows
  3. A XOR B: true in 2 of 4 rows
  4. NOT (A AND B): true in 3 of 4 rows
  5. A -> B: true in 3 of 4 rows

Processed on your device — nothing is uploaded.

How to use the truth table generator

  1. Type your expressions in Expressions (one per line). Each line becomes a result column.
  2. Tick Single-letter variables (AB means A AND B) only if you write AND by putting letters side by side.
  3. Under Show values as, choose 1 / 0 or T / F.
  4. Read the table: the input columns come first, then one column per expression.
  5. Check the Summary for each line’s verdict, and download the CSV if you need it in a spreadsheet or report.

What it does and when to use it

A truth table lists every possible combination of true and false for the inputs, and the result of the expression for each. It is the standard way to define a logic gate, test an argument in propositional logic, or prove that two statements mean the same thing.

Because you can enter several lines, the tool is especially handy for comparing expressions: write a statement and its supposed simplification, then see if the columns agree. To get the simplest form automatically, use the Boolean algebra simplifier. The set theory calculator shows the same ideas with sets, and the binary calculator applies AND, OR and XOR to whole numbers.

How it works

  1. All variables from all lines are collected and sorted.
  2. With n variables there are 2ⁿ rows. Row i uses the binary digits of i as the input values, first variable on the left.
  3. Each expression is evaluated for every row. Operators follow the usual order: NOT first, then AND, XOR, OR, IMPLIES and finally IFF. Brackets override this.
  4. The summary counts the true rows. All true is a tautology; none true is a contradiction.

The rules for the two-input operators:

A B AND OR XOR A -> B A <-> B
0 0 0 0 0 1 1
0 1 0 1 1 1 0
1 0 0 1 1 0 0
1 1 1 1 0 1 1

Step by step for P -> Q:

  1. Two variables, so 2² = 4 rows: FF, FT, TF, TT.
  2. “If P then Q” is broken only when P is true and Q is false.
  3. So the column reads T, T, F, T.

Adding the line NOT P OR Q gives the same column, which proves the two are equivalent.

Worked examples

AND. A AND B is true in just the last row; the summary says A AND B: true in 1 of 4 rows.

Implication. With T / F, the lines P -> Q and NOT P OR Q both show T | F | F | F in the third row and match everywhere else.

Tautology. A OR NOT A is true in both rows, so the summary says A OR NOT A: tautology.

De Morgan’s law. NOT (A AND B) and NOT A OR NOT B give identical columns; the last row reads 1 | 1 | 0 | 0.

Limits and tips

  • A line that does not use some variable simply ignores it.
  • If a line has a mistake, the message names the line number and position.
  • The table is built in your browser.

Frequently asked questions

How do I prove two expressions are equivalent?
Put each on its own line. If their columns match in every row, they are logically equivalent. This is how you check De Morgan's laws or show that P -> Q equals NOT P OR Q.
In what order are the rows listed?
Variables are sorted alphabetically, and the rows count up in binary from all 0 (false) to all 1 (true), with the first variable changing slowest. This is the standard order used in most textbooks.
Which symbols can I use?
Words (AND, OR, NOT, XOR, NAND, NOR, XNOR, IMPLIES, IFF) or symbols such as & | ! ~ ¬ ^ -> <->, plus ' after a variable for NOT. Brackets can be ( ) or [ ].
Why is "Single-letter variables" off by default here?
So that names like P1, Rain or Switch work as variables. Tick it if you want AB to mean A AND B, as in circuit textbooks.
How big can the table be?
Up to 12 expressions and 10 different variables in total, which is 1,024 rows. The table can be downloaded as truth-table.csv.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close