Boolean Algebra Calculator

Evaluate and simplify a Boolean expression with a full truth table, minterms, maxterms and a simplified sum of products. Check two expressions for equivalence.

A Boolean algebra calculator evaluates and simplifies a logic expression. Type an expression such as A AND (B OR NOT C) and the calculator builds the full truth table, simplifies the expression to its smallest sum of products, lists the canonical minterms and maxterms, and tells you whether the expression is always true, always false or depends on the inputs.

You can also enter a second expression to check whether the two are equivalent, which is how you prove laws such as De Morgan’s theorem. The calculator accepts up to six variables.

This calculator needs JavaScript. Please enable it in your browser.

How to write a Boolean expression

Use the words AND, OR, NOT, XOR, NAND, NOR and XNOR, or the symbols below. Variables are single letters, and writing letters together, such as AB, means AND. Brackets change the order. NOT is applied first, then AND, then XOR, then OR.

OperationWordsSymbols
ANDA AND BA&B, A*B, A·B, AB
ORA OR BA|B, A+B
NOTNOT A!A, ~A, A’
XORA XOR BA^B
NAND, NOR, XNORA NAND B, A NOR B, A XNOR Bnone

Truth tables for the basic gates

ABANDORXORNANDNORXNOR
00000111
01011100
10011100
11110001

NOT turns 0 into 1 and 1 into 0.

Boolean algebra laws

The calculator simplifies by finding the smallest set of product terms that covers every row where the expression is 1 (the Quine-McCluskey method). These laws let you simplify by hand.

LawRule
IdentityA + 0 = A and A · 1 = A
NullA + 1 = 1 and A · 0 = 0
IdempotentA + A = A and A · A = A
ComplementA + A’ = 1 and A · A’ = 0
Double negation(A’)’ = A
DistributiveA(B + C) = AB + AC and A + BC = (A + B)(A + C)
AbsorptionA + AB = A and A(A + B) = A
De Morgan(AB)’ = A’ + B’ and (A + B)’ = A’B’
ConsensusAB + A’C + BC = AB + A’C

Worked examples

Example 1: absorption

Simplify A + AB. The expression is 1 whenever A is 1, whatever B is, so it simplifies to A.

Example 2: the second distributive law

Simplify (A + B)(A + C). Expanding gives AA + AC + AB + BC = A + AC + AB + BC, and A absorbs AC and AB, so the result is A + BC. Enter A + BC in the second box to confirm the two are equivalent.

Example 3: the consensus term

Simplify AB + A’C + BC. The BC term is redundant, so the result is AB + A’C. The expression is 1 for minterms 1, 3, 6 and 7.

Example 4: De Morgan’s law

Compare NOT (A AND B) with NOT A OR NOT B. Both give 1, 1, 1, 0 down the truth table, so the calculator reports that they are equivalent, and both simplify to A’ + B’.

Example 5: XOR

A XOR B is 1 when exactly one input is 1. Its simplified sum of products is A’B + AB’.

Reading the results

  • The truth table lists every combination of inputs and the output for each.
  • Minterms are the rows where the output is 1. The canonical sum of products ORs all of them.
  • Maxterms are the rows where the output is 0. The canonical product of sums ANDs all of them.
  • A tautology is always 1, a contradiction is always 0, and anything else is contingent.

Frequently asked questions

What is Boolean algebra?

Boolean algebra is the algebra of two values, true and false, or 1 and 0. It uses the operations AND, OR and NOT, and it underlies digital circuits and programming conditions.

How do you simplify a Boolean expression?

Apply laws such as absorption, De Morgan and the distributive laws, or list the rows where the output is 1 and group them with the Quine-McCluskey method or a Karnaugh map. The calculator does the second approach automatically.

How many rows does a truth table have?

2 to the power of the number of variables. Two variables give 4 rows, three give 8 and six give 64.

What is the difference between sum of products and product of sums?

A sum of products ORs several AND terms, such as AB + A’C. A product of sums ANDs several OR terms, such as (A + B)(A’ + C). Both can describe the same function.

How do I enter NOT?

Write NOT before a variable or bracket, use ! or ~, or put an apostrophe after it, as in A’.

How do I check whether two expressions are equivalent?

Enter one in each box. The calculator compares them on every input and tells you if they match, or shows the first input where they differ.