Boolean logic tool

Truth Table Generator

Generate a complete truth table from a Boolean expression. Evaluate AND, OR, NOT, and XOR operations, see every possible combination of inputs, and identify whether the expression is a tautology, contradiction, or contingent logical function.

Generate a Truth Table

Enter an expression using variables A–Z, constants 0 and 1, parentheses, and the operators below. Up to six distinct variables are supported, producing at most 64 rows.

NOT: NOT A, !A, ~A, ¬A, A'. AND: AND, &, *, ·. XOR: XOR, ^, ⊕. OR: OR, +, |, ∨. Constants: 0 and 1.

Truth Table Results

Variables
0
Truth table rows
0
Rows where output = 1
0

Canonical sum of products (minterms)

Canonical product of sums (maxterms)

Complete truth table

Rows are displayed in binary counting order, starting with all inputs set to 0.

What Is a Truth Table?

A truth table lists every possible combination of input values for a logical expression and records the resulting output. In Boolean logic, each input and output is either 0 (false) or 1 (true).

The number of rows depends on the number of distinct variables. A function with \(n\) variables has \(2^n\) input combinations. For example, two variables produce four rows, and three variables produce eight rows.

Example: A AND B

ABA AND B
000
010
100
111

Boolean operators

OperationExampleOutput rule
NOTNOT AInverts the input.
ANDA AND B1 only when both inputs are 1.
XORA XOR B1 when the inputs differ.
ORA OR B1 when at least one input is 1.

Operator precedence

Unless parentheses specify otherwise, the calculator evaluates NOT first, then AND, then XOR, and finally OR. For example, A OR B AND C is interpreted as A OR (B AND C). Use parentheses to make complex expressions unambiguous.

Tip: a truth table is useful for checking a Boolean expression, verifying logic circuit behavior, and comparing two expressions for logical equivalence.

Understanding the Results

Tautology

A tautology is true for every possible input combination. For example, A OR NOT A always evaluates to 1.

Contradiction

A contradiction is false for every input combination. For example, A AND NOT A always evaluates to 0.

Contingent expression

A contingent expression evaluates to 1 for some input combinations and 0 for others. Most practical Boolean functions are contingent.

Minterms and maxterms

A minterm identifies an input row where the output is 1. A maxterm identifies a row where the output is 0. The calculator lists the corresponding row indices in canonical notation: Σm(...) for minterms and ΠM(...) for maxterms.

Related Binary and Logic Tools

Check that the related page filenames match your live installation.

Frequently Asked Questions

What is a truth table used for?

Truth tables are used in digital electronics, Boolean algebra, computer science, and formal logic. They help verify an expression by showing its output for every possible input.

How many rows does my truth table need?

With n distinct variables, the table contains 2 to the power of n rows. This calculator supports up to six variables, for a maximum of 64 rows.

Can I use parentheses?

Yes. Parentheses can group subexpressions, such as (A OR B) AND NOT C. They take precedence over the normal operator order.

What does XOR mean?

XOR means exclusive OR. It evaluates to 1 when exactly one of its two inputs is 1, and to 0 when both inputs have the same value.

Is my expression sent to a server?

No. Parsing, evaluation, and truth-table generation happen in your browser. The calculator does not send your expression to the server for processing.