ToolSphere

Truth Table Generator

Computer science

Generate a Boolean truth table for up to five variables. Use AND, OR, XOR and NOT, check every input combination and copy tab-separated results.

Truth table generator

Use single-letter variables (A-Z). Operators: & or * (AND), | or + (OR), ^ (XOR), ! or ~ (NOT). Parentheses supported. Adjacent letters imply AND (e.g. AB means A AND B).

ABCResult
0001
0010
0101
0110
1001
1010
1101
1111

On this browser only

Give feedback

Did this tool help?

Tell us what worked, what didn’t, or what you’d like next.

Opens Google Forms in a new tab with this tool’s name filled in. No sign-in or email required. Feedback is optional.

How to use Truth Table Generator

  1. 1Enter a Boolean expression with single-letter variables, using at most five distinct letters.
  2. 2Use & or * for AND, | or + for OR, ^ for XOR, and ! or ~ before an expression for NOT.
  3. 3Add parentheses to make grouping explicit, especially when mixing OR and XOR.
  4. 4Read the variable columns and Result column for every input combination; the table updates as you type.
  5. 5Copy the table as tab-separated text for a spreadsheet or document. Correct any input error before copying.

About Truth Table Generator

Generate a Boolean truth table online

This truth table generator evaluates a Boolean expression for every combination of its inputs. Type an expression, and the table updates automatically with a column for each variable and a final Result column. It supports up to five distinct variables, which produces at most 32 rows. Use it to check a digital logic exercise, compare a proposed circuit expression or review a discrete mathematics assignment.

The table shows false as 0 and true as 1. Variables are sorted alphabetically, and the rows follow binary counting order with the leftmost variable changing slowest. The copy control exports the complete table as tab-separated text, including its header. You can paste that text into a spreadsheet without manually recreating the columns.

Enter the supported operators

Use & or * for AND, | or + for OR, ^ for XOR, and ! or ~ for NOT. NOT goes before its operand, so !A means NOT A and !(A|B) negates a parenthesized group. Adjacent letters imply AND: AB is the same as A&B. Explicit operators are often easier to review in longer expressions.

Variables must be single letters. Lowercase input is normalized to uppercase, so a and A refer to the same variable. Names containing digits or multiple-letter identifiers are not supported as names: x1 is invalid, while AB is a product of two variables rather than a variable called AB. Writing English words such as AND also enters letters, not an operator keyword.

The parser does not accept apostrophe complements, implication arrows, equivalence symbols or standalone numeric constants. Translate notation from a textbook before entering it. For example, replace a complemented A with !A and use parentheses around the full expression being negated. A syntax error appears in place of the table while the input is incomplete or invalid.

Operator precedence and parentheses

NOT binds most tightly, then AND. OR and XOR share a precedence level in this parser and are evaluated left to right. Consequently A|B^C is interpreted as (A|B)^C. If you intend A|(B^C), enter those parentheses explicitly. This convention can differ from the precedence rules in a programming language you are studying.

Parentheses are also the simplest way to communicate your intended circuit. Compare !(A&B) with !A&B: the first negates the whole AND output, while the second negates only A before the AND operation. Balanced brackets matter; a missing closing parenthesis prevents the tool from producing a valid table.

Use the operator symbols shown beside the input rather than copying an expression unchanged from another calculator. In this interface, the caret means exclusive OR, not exponentiation. The result is a Boolean output, not an arithmetic sum, even when the alternative + and * notation is used.

Worked example: A&B | !C

The default expression is A&B | !C, interpreted as (A AND B) OR (NOT C). Its three variables create eight possible input assignments. The rows below were generated with the same parser and truth-table builder used by the interface.

A B C Result
0 0 0 1
0 0 1 0
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 1

Whenever C is false, !C is true and the OR output is true regardless of A and B. When C is true, the output depends on A&B, so both of those inputs must be true. This is a useful way to check the table by reasoning about cases instead of repeating the full expression mechanically in every row.

Compare expressions and identify special cases

Two expressions are equivalent when their outputs match for every assignment of the same variables. This interface has one expression input, so compare results by copying one table and then entering the other expression. If the detected variable sets differ, align assignments carefully instead of comparing row numbers alone.

An output that is true on every assignment is a tautology; an output that is false on every assignment is a contradiction. A mixed output is contingent on the inputs. The generator shows the rows but does not add an automatic classification badge or calculate intermediate subexpression columns. Read the final column to make that assessment.

A truth table is exhaustive for the expression's listed variables, but it describes a static logical function. It does not model switching delays, electrical voltage thresholds, sequential memory or how a physical circuit behaves while inputs change. Use it to establish the intended logic before checking hardware-specific behavior separately.

Copy, simplify and troubleshoot

The row-count formula is 2ⁿ for n distinct variables. Repeating a letter does not add a variable or double the table size. If the expression contains more than five distinct letters, the interface asks you to reduce the variable count so the table remains readable. Copy is available when the current expression has a valid table.

For simplification, transfer the true minterms manually to the Karnaugh map solver, which supports up to four variables. For individual gate behavior, use the logic gate simulator. Read the truth tables guide and logic gates guide for additional notation and exercises.

Guides and tutorials

Frequently asked questions

How do I generate a truth table from an expression?

Enter a valid Boolean expression with single-letter variables. The table updates automatically and lists every assignment with its final result.

Which Boolean operators can I use?

Use & or * for AND, | or + for OR, ^ for XOR, and ! or ~ for NOT. Parentheses control grouping and adjacent letters imply AND.

How many variables does the generator support?

It supports up to five distinct variables, giving at most 32 rows. Reusing a variable does not increase that count.

Are lowercase and uppercase variables different?

No, letters are normalized to uppercase. Entering a and A therefore refers to the same logical input.

Can I use implication or equivalence symbols?

Those symbols are not accepted directly. Rewrite the proposition with the supported Boolean operators before entering it.

What is the precedence of OR and XOR?

OR and XOR have equal precedence here and are evaluated left to right. Use parentheses whenever you want a particular mixed grouping.

Can I enter A prime or an overbar for NOT?

Use prefix ! or ~ instead of apostrophe or overbar notation. Put parentheses after NOT when you want to negate a whole expression.

Does the output include intermediate steps?

It shows each input variable and the final result for every row. It does not generate separate columns for intermediate subexpressions.

How can I copy the truth table?

Use the copy control above the valid table. It copies a header and rows separated by tabs and line breaks for pasting into a spreadsheet or document.

Can this simplify my Boolean expression?

This page evaluates the expression but does not minimize it. Use the Karnaugh map solver for a separate simplification workflow with up to four variables.

Have a suggestion for Truth Table Generator?Share your feedback ↗