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.
| Operation | Words | Symbols |
|---|---|---|
| AND | A AND B | A&B, A*B, A·B, AB |
| OR | A OR B | A|B, A+B |
| NOT | NOT A | !A, ~A, A’ |
| XOR | A XOR B | A^B |
| NAND, NOR, XNOR | A NAND B, A NOR B, A XNOR B | none |
Truth tables for the basic gates
| A | B | AND | OR | XOR | NAND | NOR | XNOR |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 | 1 | 0 | 0 |
| 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 |
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.
| Law | Rule |
|---|---|
| Identity | A + 0 = A and A · 1 = A |
| Null | A + 1 = 1 and A · 0 = 0 |
| Idempotent | A + A = A and A · A = A |
| Complement | A + A’ = 1 and A · A’ = 0 |
| Double negation | (A’)’ = A |
| Distributive | A(B + C) = AB + AC and A + BC = (A + B)(A + C) |
| Absorption | A + AB = A and A(A + B) = A |
| De Morgan | (AB)’ = A’ + B’ and (A + B)’ = A’B’ |
| Consensus | AB + 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.