Type an expression with AND, OR, NOT, XOR, NAND, NOR, or XNOR and get its table for up to 6 variables. You also get canonical SOP and POS forms, minterms, and a check for whether two expressions are equivalent.
Boolean expression
Expression (fully parenthesized)
((A AND B) OR NOT C)
Variables
3
Rows with output 1
5
Rows with output 0
3
Truth table
| # | A | B | C | OUT |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 2 | 0 | 1 | 0 | 1 |
| 3 | 0 | 1 | 1 | 0 |
| 4 | 1 | 0 | 0 | 1 |
| 5 | 1 | 0 | 1 | 0 |
| 6 | 1 | 1 | 0 | 1 |
| 7 | 1 | 1 | 1 | 1 |
Canonical forms
Canonical SOP (sum of minterms)
(NOT A AND NOT B AND NOT C) OR (NOT A AND B AND NOT C) OR (A AND NOT B AND NOT C) OR (A AND B AND NOT C) OR (A AND B AND C)
Canonical POS (product of maxterms)
(A OR B OR NOT C) AND (A OR NOT B OR NOT C) AND (NOT A OR B OR NOT C)
Minterms
Σm(0, 2, 4, 6, 7)
Maxterms
ΠM(1, 3, 5)
Precedence without parentheses: NOT, then AND/NAND, then XOR/XNOR, then OR/NOR, then →, then ↔. Operators at the same level are read left to right. Use parentheses if you are not sure how an expression is grouped.
Truth Tables for Boolean Expressions and Logic Gates
A truth table lists every combination of 0 and 1 for the variables in a Boolean expression and shows the output for each one. You use it in digital logic and discrete math courses to check an expression, compare two circuits, or start deriving a simplified form.
This tool reads an expression written with AND, OR, NOT, XOR, NAND, NOR, and XNOR, plus implication (→) and "if and only if" (↔), and builds the table for up to 6 variables. It then lists the canonical SOP and POS forms, the minterm and maxterm row numbers, and can compare two expressions row by row.
Both word syntax (A AND NOT B) and textbook shorthand (AB' + A'B) work. Examples for logic gates, half and full adders, a 2:1 multiplexer, and De Morgan's law are one click away, and you can edit them after loading.
Typical uses: coursework, exam prep, circuit checks
Digital logic homework and lab reports
Build the table by hand, then paste your expression here to confirm every row before you hand it in.
Discrete math and computer science exams
Practice problems on logical equivalence, implication, and canonical forms. Check your own working against the generated rows.
Checking a simplified circuit
Enter the original and the simplified expression in compare mode. The Match column shows any row where they disagree.
Refactoring conditions in code
Paste a condition written with &&, ||, and !, and compare it with the rewritten version to see whether they behave the same for every input.
Looking up adder and multiplexer logic
Load the half adder, full adder, majority, or 2:1 multiplexer example and read its table and canonical forms.
Getting a starting point for minimization
Copy the minterm list or canonical SOP and use it as input for a Karnaugh map or Quine–McCluskey worksheet.
How to enter an expression and read the results
- Type or paste an expression into the input, for example (A AND B) OR (NOT C) or A'B + AB'. Letters A to Z are variables, and 0 and 1 are constants.
- The tool detects the variables, sorts them alphabetically, and shows the table as you type. Check the fully parenthesized expression above the table to confirm how it was read.
- To compare two expressions, turn on "Compare two expressions" and enter the second one. A Match column and an equivalence message appear.
- Pick a display format (words, symbols, code, or algebra), and filter the rows to output 1 or output 0 if the table is long.
- Use "Copy table" to paste the rows into a spreadsheet, or "Copy results" for the expression, canonical SOP and POS, minterms, and maxterms.
Note: The example buttons load an expression you can edit. The De Morgan and XOR examples also turn on compare mode.
Syntax rules, precedence, and limits
- Operators are not case-sensitive. NAND, NOR, and XNOR are written as words, or as ⊼, ⊽, and ⊙.
- Letters that spell an operator (AND, OR, NOT, XOR, NAND, NOR, XNOR) are read as that operator. Put a space between variables if their letters could join into one of these words.
- Without parentheses, the order is NOT, then AND/NAND, then XOR/XNOR, then OR/NOR, then →, then ↔. Operators on the same level are read left to right, except →, which is read right to left.
- Variables are single letters from A to Z. Up to 6 variables are allowed, which means up to 64 rows. In compare mode, the limit covers both expressions together.
- Columns are in alphabetical order with the first variable as the most significant bit. The # column is the row number used in the minterm and maxterm lists.
- In compare mode, the canonical forms, minterms, maxterms, row counts, and row filter all refer to expression 1.
- An expression with only constants, such as 1 or 0, has no variables, so no table is shown.
- The expression is processed in your browser, and the tool does not send it to a server.
Logic gate reference: AND, OR, XOR, NAND, NOR, XNOR
Outputs of the two-input gates and implication for each combination of A and B. Load any of them from the example buttons to see the same table in the tool.
| A | B | AND | OR | XOR | NAND | NOR | XNOR | A → B |
|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 1 |
| 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 1 |
NOT takes one input: the output is 1 when A is 0 and 0 when A is 1. A ↔ B gives the same outputs as XNOR.
Boolean algebra basics: precedence, SOP/POS, minterms
Short notes on reading the results correctly.
Operator precedence and parentheses
Without parentheses, NOT binds tightest, then AND/NAND, then XOR/XNOR, then OR/NOR. So A OR B AND C means A OR (B AND C). Operators on the same level are grouped from the left, which matters for NAND and NOR because they are not associative: A NAND B NAND C means (A NAND B) NAND C. The shorthand A'B + C is read as ((NOT A) AND B) OR C.
Canonical SOP and POS
Canonical SOP takes each row where the output is 1, ANDs all the variables (complemented where the row has a 0), and ORs those terms together. Canonical POS takes each row where the output is 0, ORs all the variables (complemented where the row has a 1), and ANDs those terms. Both describe the same function. They are not minimized, so they usually have more terms than necessary.
Minterms and maxterms
Read a row's variable values as a binary number to get its index. With variables A, B, C, the row A=1, B=0, C=1 is 101, which is 5. If the output on that row is 1, 5 is in the minterm list Σm; if it is 0, 5 is in the maxterm list ΠM. The two lists together cover every row exactly once.
Half adder and full adder expressions
A half adder adds two bits: Sum = A XOR B and Carry = A AND B. A full adder adds a carry-in C as well: Sum = (A XOR B) XOR C and Carry = (A AND B) OR (C AND (A XOR B)). All four are in the example buttons.
De Morgan's laws and equivalence
De Morgan's laws say NOT (A AND B) equals (NOT A) OR (NOT B), and NOT (A OR B) equals (NOT A) AND (NOT B). Two expressions are logically equivalent when they give the same output on every row, which is exactly what compare mode tests. The De Morgan example button loads the first law.
Common errors and how to fix them
The table does not match what you meant because of precedence
You typed A OR B AND C and expected (A OR B) AND C. The tool reads it as A OR (B AND C), because AND binds tighter than OR.
💡 See the solution▼
Chained NAND or NOR gives an unexpected result
A NAND B NAND C is read as (A NAND B) NAND C, which is not the same as NOT (A AND B AND C).
💡 See the solution▼
Letters join into an operator word
Letters written together that spell AND, OR, NOT, XOR, NAND, NOR, or XNOR are read as that operator, not as separate variables.
💡 See the solution▼
A parenthesis is missing or extra
The number of "(" and ")" does not match, and the tool shows an error instead of a table.
💡 See the solution▼
Unrecognized character in the expression
Characters outside the supported set, such as =, <, >, or a lone -, cause an "Unrecognized character" error.
💡 See the solution▼
More than 6 variables
The tool stops at 6 variables. In compare mode, the variables of both expressions count together, so two 4-variable expressions with different letters exceed the limit.
💡 See the solution▼
Comparing two tables by eye
With 32 or 64 rows, a single differing row is easy to miss when you scan two tables manually.
💡 See the solution▼
Questions about syntax, SOP/POS, and equivalence
Q.How do I make a truth table from a Boolean expression?
A. Type the expression into the input, for example (A AND B) OR (NOT C). The tool finds the variables, lists every combination of 0 and 1 for them, and evaluates the expression on each row. The table updates as you type.
Q.Which operators and symbols can I use?
A. Words: AND, OR, NOT, XOR, NAND, NOR, XNOR (not case-sensitive). Symbols: & && ∧ · * for AND, | || ∨ + for OR, ! ~ ¬ before a variable or ' after it for NOT, ^ ⊕ for XOR, and ⊼ ⊽ ⊙ for NAND, NOR, XNOR. You can also use -> or → for implication and <-> or ↔ for "if and only if". Use 0 and 1 as constants.
Q.How many variables does it support?
A. Up to six variables, which gives a table of 64 rows. Each variable is a single letter from A to Z. In compare mode, the limit applies to the variables of both expressions combined.
Q.In what order are operators evaluated?
A. Without parentheses: NOT first, then AND and NAND, then XOR and XNOR, then OR and NOR, then implication, then "if and only if". Operators on the same level are read left to right, except implication, which is read right to left. Parentheses override all of this.
Q.Can I type Boolean algebra shorthand like A'B + AB'?
A. Yes. An apostrophe after a variable or a closing parenthesis means NOT, + means OR, and variables written next to each other are ANDed, so A'B + AB' is read as (NOT A AND B) OR (A AND NOT B). The "Algebra" display format prints results in the same style.
Q.What are canonical SOP and POS, and does the tool simplify them?
A. Canonical SOP is an OR of AND terms, one term for each row where the output is 1, with every variable in every term. Canonical POS is an AND of OR terms, one for each row where the output is 0. The tool lists these forms as they come from the table. It does not minimize them, so use a Karnaugh map or the Quine–McCluskey method if you need a simpler expression.
Q.How do I check whether two Boolean expressions are equivalent?
A. Turn on "Compare two expressions" and enter both. The tool builds one table over all the variables, adds an output column for each expression and a Match column, and reports whether every row matches. If they differ, it shows how many rows do.
Q.How are minterm and maxterm numbers assigned?
A. Each row number is the row's variable values read as a binary number, with the alphabetically first variable as the most significant bit. For A, B, C, the row A=1, B=0, C=1 is binary 101, which is row 5. Minterms are the rows where the output is 1, and maxterms are the rows where it is 0.
Q.Is my expression sent to a server?
A. No. Parsing and table generation run in your browser, and this tool does not send the expression anywhere. Your input is kept only in the page, so reloading or closing the tab clears it.
Your feedback
makes this tool better.
Tell us which features you'd like, what should be fixed, or which new tool you'd like to see. An engineer reads every submission and uses it to guide development.