Boolean algebra calculator
Simplify any Boolean expression and see each law that gets you there. Type something like A'B + AB' + AB and get the shortest sum of products and product of sums, the truth table, the minterms and a logic circuit, all checked row by row.
Examples:
Step-by-step simplification
Truth table
Canonical forms, minterms and maxterms
Logic circuit
As code
Check if two expressions are equivalent
Runs in your browser. Nothing you type is uploaded.
How to use the Boolean algebra simplifier
- Type the expression in the box, for example
A'B + AB' + AB. Write NOT as an apostrophe after a variable, OR as + and AND by putting letters side by side. The buttons under the box insert the symbols that are hard to type, such as ⊕. - Read the simplified answer at the top. You get the shortest sum of products (SOP) and product of sums (POS), with the number of terms and literals so you can see how much was saved.
- Open "Step-by-step simplification" to see each law that was applied, in order, with the expression after every step.
- Use the other panels when you need them: the truth table, the minterm and maxterm lists, a logic circuit drawn from the answer, or the answer written as C, Python, Verilog or a spreadsheet formula.
- To check a homework answer, open "Check if two expressions are equivalent" and type your version. The calculator tests every row of the truth table and, if they differ, shows a row where they give different outputs.
If you work in logic notation, switch "Notation" to Logic. Input in either style is accepted at any time; the setting only changes how the answers are written. For a full table with every intermediate column, the truth table generator uses the same engine.
How to type a Boolean expression
The calculator reads the notation from digital electronics textbooks and the notation from logic courses, and you can mix them. Variables are letters, optionally followed by digits, so A, x and S1 all work. Upper and lower case count as different variables.
| Operation | Type | Also accepted | Example |
|---|---|---|---|
| NOT | A' | !A ~A ¬A NOT A | (A + B)' |
| AND | AB | A*B A.B A & B A ∧ B A AND B | AB'C |
| OR | A + B | A | B A || B A ∨ B A OR B | A + B'C |
| XOR | A ^ B | A ⊕ B A XOR B | A ⊕ B ⊕ C |
| XNOR | A XNOR B | A ⊙ B | A XNOR B |
| NAND | A NAND B | A ↑ B | A NAND B |
| NOR | A NOR B | A ↓ B | A NOR B |
| Implies | A -> B | A → B A => B | p -> q |
| If and only if | A <-> B | A ↔ B A <=> B A == B | p <-> q |
| Constants | 0 1 | T F true false | A + 0 |
| Minterm list | Σm(1, 3, 5) | m(1,3,5) ΠM(0, 4) F(A, B, C) = Σm(1, 3) | Σm(1, 3) + d(2) |
Because T and F are read as true and false, use other capital letters for variables. A leading F = or F(A, B, C) = is ignored, so you can paste a line straight from your notes. A minterm list works too: Σm(1, 3, 7, 11, 15) + d(0, 2, 5) simplifies the function that is 1 on those rows, with d( ) for the don't cares.
Without brackets, NOT is applied first, then AND, then XOR, then OR, then implies, then if and only if. So A + BC means A + (BC), the same order you know from 2 + 3 × 4. Implies groups from the right: p → q → r is p → (q → r). When in doubt, add brackets. They never hurt, and the "Start" line in the steps shows how the calculator read your input.
Worked example: simplify A'BC + AB'C + ABC' + ABC
This is the majority function of three inputs: the output is 1 when at least two of A, B and C are 1. It shows up in the carry output of a full adder, and it is the default expression in the calculator above. Here is how the laws reduce it.
- Pair
A'BCwithABC. They are identical except for A, so A drops out:A'BC + ABC = BC(A' + A) = BC. The expression becomesBC + AB'C + ABC'. - Now
AB'Csits next toBC. Whenever C is 1 and B is 1,BCalready makes the output 1, so theB'inAB'Cadds nothing. Dropping it givesAC, and the expression isBC + AC + ABC'. This is the redundant literal rule,X + X'Y = X + Y. - The same rule turns
ABC'intoAB, because ofBC. The result isBC + AC + AB.
That is AB + AC + BC: three AND gates and one OR gate instead of four 3-input AND gates and one 4-input OR gate. You can confirm it by reading the truth table. The function is 1 on rows 3, 5, 6 and 7, written Σm(3, 5, 6, 7), and each of those rows has at least two 1s.
The product of sums for the same function is (A + B)(A + C)(B + C). It comes from the rows where the output is 0, ΠM(0, 1, 2, 4), and needs three OR gates and one AND gate. Neither form is "more correct"; you pick the one that fits the gates you have.
The Boolean algebra laws behind the steps
Each step in the calculator names the law it used, so you can match it to your textbook. These are the laws behind the steps, with X, Y and Z standing for any variable or sub-expression. Identity and annulment work quietly inside other steps, and the first steps for XOR, NAND, NOR and the arrows are labeled with the definition of that operator.
| Law | Algebra form | What it says |
|---|---|---|
| Identity | X + 0 = X, X · 1 = X | ORing with 0 or ANDing with 1 changes nothing |
| Annulment | X + 1 = 1, X · 0 = 0 | one 1 makes an OR true, one 0 makes an AND false |
| Idempotent | X + X = X, XX = X | repeating a term changes nothing, so a term can also be written twice |
| Complement | X + X' = 1, XX' = 0 | a variable and its opposite cover every case, or none |
| Double negation | (X')' = X | two NOTs cancel |
| De Morgan | (XY)' = X' + Y', (X + Y)' = X'Y' | push a NOT inside a bracket by flipping AND and OR |
| Distributive | X(Y + Z) = XY + XZ | multiply out, as in ordinary algebra |
| Absorption | X + XY = X | a longer term is swallowed by a shorter term it contains |
| Combining | XY + XY' = X | two terms that differ in one variable merge, and that variable drops out |
| Redundant literal | X + X'Y = X + Y | the NOT X inside the second term is not needed |
| Consensus | XY + X'Z + YZ = XY + X'Z | the YZ term is already covered by the other two |
De Morgan's laws get their own page, with gate diagrams: De Morgan's law explained. For the ideas behind the rest, including why OR is written as + at all, read the Boolean algebra guide.
Operators that are not AND, OR or NOT are rewritten first. A → B becomes A' + B, A ⊕ B becomes AB' + A'B, and NAND and NOR become a NOT around an AND or OR. After that, De Morgan's law pushes every NOT down to a single variable, the distributive law multiplies everything out, and the laws above shrink the result.
Why the steps sometimes stop early
Algebra with these laws is a search, and the order matters. Sometimes the shortcut only appears after you split a term back into the minterms it came from, which no textbook step tells you to do. When that happens the steps end at an expression that is correct but not the shortest, and the calculator says so.
The answer at the top does not depend on the steps. It comes from the Quine-McCluskey method: list every row where the output is 1, merge rows that differ in one variable until nothing more merges (those are the prime implicants), then pick the fewest prime implicants that cover every 1. This is the same thing you do by hand on a Karnaugh map, written as a procedure a computer can follow. Up to 8 variables are supported. With 6 or more variables and a scattered set of 1s (almost always at 7 or 8), the search can stop before it has proved the answer is the shortest, and the calculator then says a shorter form may exist. The answer is still correct.
The SOP answer is checked against the truth table of your input across all 2n rows, and the line "Checked against all 8 rows of the truth table" under the result confirms that it passed.
Mistakes that give the wrong answer
You meant NOT of the whole product but wrote it on each letter. A'B' (NOT A and NOT B) and (AB)' (NOT of A AND B) are different functions. The first is 1 in one row out of four, the second in three. If your answer and the book's disagree, look for a missing bracket before the apostrophe.
You expected OR to happen first. A + BC is A + (BC), not (A + B)C. Type the brackets if you want the second reading.
You used ^ for NOT or for power. In this calculator, as in C, Java and Python, ^ is XOR. A^B is 1 when exactly one of A and B is 1. For NOT, use an apostrophe or !. The XOR calculator covers XOR on whole binary numbers.
Your variables run together. AB is A AND B, but A1B is the variable A1 AND B, because digits stick to the letter before them. Write A·1·B or A * 1 * B if you meant the constant 1.
Two correct answers look different. Some functions have more than one minimal form. A'B + B'C + AC' and A'C + BC' + AB' are both minimal for the same function. Paste your answer into the equivalence box to confirm it instead of comparing letter by letter.
From the answer to a circuit or to code
The logic circuit panel works as a logic gate calculator: it draws the simplified SOP as AND gates feeding one OR gate, with a small circle wherever an input is inverted. It is a two-level circuit, the kind you would wire on a breadboard from basic logic gates or describe in an HDL.
The code panel writes the same answer for C, C++, Java and JavaScript ((A && B) || (A && C) || (B && C)), Python ((A and B) or (A and C) or (B and C)), Verilog (assign F = (A & B) | (A & C) | (B & C);) and Excel or Google Sheets (=OR(AND(A,B),AND(A,C),AND(B,C))). A simplified condition in an if statement is shorter to read and has fewer cases to test than the original.
Frequently asked questions
How do you simplify a Boolean expression?
Rewrite it with AND, OR and NOT only, push NOTs inward with De Morgan's law, multiply out, then merge terms that differ in one variable (XY + XY' = X) and drop terms that other terms cover. A Karnaugh map does the same merging visually for up to 4 or 5 variables.
What is the difference between SOP and POS?
A sum of products ORs together AND terms, such as AB + AC + BC, and comes from the rows where the output is 1. A product of sums ANDs together OR terms, such as (A + B)(A + C)(B + C), and comes from the rows where the output is 0. Both describe the same function.
What are minterms and maxterms?
A minterm is an AND term that uses every variable once, plain or complemented, so it is 1 in exactly one row of the truth table. The list of rows where the output is 1 is written Σm(...). A maxterm is an OR term that uses every variable once, so it is 0 in exactly one row, and the rows where the output is 0 are written ΠM(...). The two lists together cover every row.
Can this calculator check if two Boolean expressions are equal?
Yes. Open "Check if two expressions are equivalent" and type the second expression. It compares the outputs in every row of the truth table and shows a row where they differ if they are not equal.
How many variables can I use?
Up to 8, which means a truth table of 256 rows. The step-by-step algebra is shown when the expression multiplies out to 96 terms or fewer; above that you still get the simplified answer, the truth table and the circuit.
Does it support XOR, NAND and NOR?
Yes, as ^ or ⊕, NAND or ↑, and NOR or ↓, plus XNOR, implies and if and only if. They are rewritten into AND, OR and NOT before simplifying, and the steps show that rewrite.
Who invented Boolean algebra?
George Boole, an English mathematician, first in The Mathematical Analysis of Logic (1847) and more fully in The Laws of Thought (1854). The modern form, with an inclusive OR, was shaped by later logicians such as William Jevons and Charles Peirce. In 1937 Claude Shannon showed in his master's thesis that the same algebra describes relay and switching circuits, which is why it is the basis of digital electronics.

