Free Online Engineering Tools

Truth Table Generator — Boolean Expression Calculator

Enter any Boolean expression — using AND, OR, NOT, XOR and more — and instantly get the full truth table, complete with intermediate sub-expression columns. Toggle between 1/0 and True/False output.

1Enter a Boolean Expression
Try an example:
A AND B A OR NOT B A XOR B (A & B) OR !C A -> B A <-> B A OR NOT A
AND OR NOT XOR NAND NOR XNOR -> <-> ( )
TRY AN EXAMPLE:
(A AND B) OR NOT C P AND (Q OR R) NOT (P OR Q) P -> Q P XOR Q A OR NOT A
📋Output Format
🔍Show Steps
💡
Pro Tip
Use single-letter variables (A, B, C…) and any notation: AND or & or *, OR or | or +, NOT or ! or ~. Up to 6 variables.
2Truth Table
3Summary
Variables
3
Rows (2ⁿ)
8
Outputs True
5
Outputs False
3
Classification
Contingency
Sub-expressions
2
How to Read It
Each row is one input combination. Blue columns are the variables; the green final column is the expression's output. Sub-columns show intermediate results.

What Is a Truth Table Generator?

A truth table generator takes a Boolean expression — a formula built from variables and logical operators — and lists its output for every possible combination of true and false inputs. An expression with n variables produces 2n rows, one for each input combination. This tool parses your expression, identifies the variables automatically, and builds the complete table, including intermediate sub-expression columns so you can see exactly how the final result is assembled. It is ideal for discrete math, digital logic, and computer-science coursework.

How to Use This Calculator

1. Type a Boolean expression using single-letter variables (A, B, C…) and operators. 2. Pick an output format — 1/0 or True/False. 3. Choose whether to show sub-columns for the intermediate steps. The full truth table appears instantly, with the variables in blue, intermediate results in the middle, and the final output in the green column. Use the operator chips to insert symbols, and the Copy button to grab the table as tab-separated text.

Supported Operators and Notation

The generator accepts several common notations for each operator, so you can type whichever you are used to:

OperatorAccepted inputSymbolMeaning
ANDAND   &   *   .true only if both are true
OROR   |   +true if either is true
NOTNOT   !   ~¬inverts the value
XORXOR   ^true if inputs differ
NAND / NOR / XNORNAND   NOR   XNOR↑ ↓ ⊙inverted AND / OR / XOR
Implies->   =>false only if true → false
Iff (biconditional)<->   <=>true if both are equal

Use parentheses to group sub-expressions, for example (A AND B) OR NOT C. Precedence follows the usual order: NOT binds tightest, then AND/NAND, then XOR/XNOR, then OR/NOR, then implication, then biconditional.

How Many Rows Does a Truth Table Have?

Variables (n)Rows (2ⁿ)
12
24
38
416
532
664

Each extra variable doubles the number of rows, which is why truth tables grow quickly. This generator supports up to 6 variables (64 rows) while keeping the table readable.

Worked Example

(A AND B) OR NOT C

With three variables there are 8 rows. The generator shows two intermediate columns — A ∧ B and ¬C — then combines them with OR in the final column. The output is true in 5 of the 8 rows, so the expression is a contingency (neither always true nor always false).

Tautology, Contradiction, and Contingency

Once a truth table is built, the final column classifies the expression. A tautology is true in every row (for example, A OR NOT A). A contradiction is false in every row (A AND NOT A). Anything in between is a contingency. The summary panel reports this automatically, which is handy for checking logical equivalences and proofs.

Using P, Q, R or A, B, C Variables

The generator accepts any single letters as variables, so you can use the A, B, C convention common in digital logic or the P, Q, R convention used in propositional logic and discrete math — both work identically. Input is case-insensitive, and you can even drop in the constants 1/0 or True/False to pin a value. For example, P AND (Q OR R) and A AND (B OR C) generate the same 8-row table structure.

Checking Logical Equivalence with Truth Tables

One of the most useful things a truth table proves is logical equivalence: two expressions are equivalent if their output columns match on every row. A classic example is De Morgan's Law, which states that NOT (P OR Q) equals NOT P AND NOT Q. Generate each and compare:

PQ¬(P ∨ Q)¬P ∧ ¬Q
0011
0100
1000
1100

The two output columns are identical, proving the equivalence. The same technique verifies any logic-law simplification before you rewrite a circuit or condition.

Where Truth Tables Are Used

Truth tables are fundamental to digital logic design, discrete mathematics, propositional logic, and programming (evaluating complex conditionals). They verify that two expressions are equivalent, reveal redundant logic, and are the starting point for circuit minimization. To explore individual gates, use the Logic Gate Calculator; for whole-number bit operations, see the Bitwise Calculator; and for the binary itself, the Binary Calculator and Number System Converter.

Next step: Explore the gates behind each operator in the Logic Gate Calculator, or apply logic per bit in the Bitwise Calculator.

Ready to minimize that expression? The K-Map Solver turns minterms into the simplest Sum of Products with color-coded Karnaugh-map groupings.

Frequently Asked Questions

What is a truth table?

A chart listing every combination of true/false values for an expression's variables and the resulting output. An expression with n variables has 2n rows.

How do I write a Boolean expression for this generator?

Use single-letter variables and operators. AND can be written AND, & or *; OR as OR, | or +; NOT as NOT, ! or ~; plus XOR, NAND, NOR, XNOR, -> and <->. Group with parentheses.

How many rows does a truth table have?

2n rows for n variables: 2 variables give 4 rows, 3 give 8, 4 give 16. This tool supports up to 6 variables (64 rows).

What operators does the truth table generator support?

AND, OR, NOT, XOR, NAND, NOR, XNOR, implication (->) and biconditional (<->), combined freely with parentheses. Intermediate sub-expression columns show how the result is built.

What is the difference between a truth table and a Boolean expression?

A Boolean expression is the formula; a truth table is the full list of its outputs for every input. The table completely describes what the expression does.

What is a tautology, contradiction, and contingency?

A tautology is true in every row (e.g. P OR NOT P); a contradiction is false in every row (P AND NOT P); a contingency is true in some rows and false in others. The generator labels your expression automatically.

How do I check if two Boolean expressions are equivalent?

Generate a truth table for each and compare the output columns. If they match on every row, the expressions are logically equivalent — as with De Morgan's law, NOT (P OR Q) = NOT P AND NOT Q.

Can a truth table have more than two variables?

Yes — each extra variable doubles the rows. Three give 8, four give 16. This generator handles up to 6 variables while keeping the table readable.