Advertisement

Truth table generator

Enter a logical expression using variable names and operators, evaluate one assignment, or generate the standard gate tables. Use 1 for true and 0 for false.

Calculator

Use ! or NOT, & or AND, ^ or XOR, | or OR, ->, <->, NAND, NOR, XNOR and parentheses. Up to eight variables.

True rows
1
False rows
3
Expression classification
Contingent
Variable order
p, q
Truth table
InputsResult
p=0, q=0False
p=0, q=1False
p=1, q=0False
p=1, q=1True

Advertisement

How this calculator works

Each independent logical variable can be false or true, so n variables produce 2^n assignments. The tool evaluates an expression under each assignment and counts the outcomes. A tautology is true on every row, a contradiction false on every row, and a contingent expression has both outcomes. Variable names are case-insensitive and sorted alphabetically. Parentheses override precedence. Without them, the order is NOT, AND/NAND, XOR/XNOR, OR/NOR, implication, then equivalence. Implication associates to the right. Other binary chains associate to the left. Eight variables give 256 visible rows.

Formula

Rows = 2^n. p -> q means NOT p OR q and is false only when p is true and q is false. p <-> q is true when both truth values agree.

Worked example

For p AND q, the assignments (0,0), (0,1), (1,0), (1,1) give false, false, false, true. For p -> q, only (1,0) is false, so three of the four rows are true.

Advertisement

Frequently asked questions

Is this a calculator or a text generator?

It calculates Boolean outcomes from explicit logical rules and returns a table of independently testable values. It does not generate prose or execute typed code.

Can I use words instead of symbols?

Yes. NOT, AND, OR, XOR, NAND, NOR and XNOR are accepted as operators. Use parentheses around compound groups when clarity matters.

How do I evaluate just one row?

Select the single-assignment mode and enter one 0 or 1 for each variable in the alphabetical order shown in the result. A constant expression can be evaluated in complete-table mode.

Sources

Advertisement