Boolean algebra calculator: simplify expressions step by step
Type a Boolean expression and this calculator simplifies it one law at a time, from De Morgan and distribution through absorption and the consensus theorem, until it reaches the simplest sum of products. It also gives the simplest product of sums, and checks every step against the full truth table.
On this page
How to use the simplifier
Enter an expression in whichever notation your course or textbook uses. In digital-logic style, juxtaposition means AND, + means OR and a prime means NOT, so AB + A'C is . In logic style, write A and B or not A and C, or paste symbols such as ∧, ∨ and ¬. Implication (->), the biconditional (<->), XOR, NAND and NOR are accepted too, and are rewritten away in the first steps.
With “Single-letter variables” ticked, AB is read as A AND B, which is what most circuit textbooks mean. Untick it if your variables have longer names, such as rain and wet; then AB is one variable called AB. Names with digits, like x1 and x2, work either way.
The results show the minimal DNF (fewest product terms, then fewest literals) and the minimal CNF (the same for sums), written both in textbook notation (AB′ + C) and in logic notation. Below them is the full derivation. Each step shows the whole expression after one law has been applied, the name of the law, and the instance of it that was used. The button under the steps copies the derivation as a LaTeX align* block, with each law as a right-hand annotation, ready for homework or lecture notes. The address bar keeps your expression, so you can bookmark or share a derivation.
The laws it uses
Every step is one of the standard identities below. Each has a dual: swap AND with OR and 0 with 1. Juxtaposition () means AND in the table.
| Law | AND form | OR form (dual) |
|---|---|---|
| Identity | ||
| Annulment (domination) | ||
| Idempotence | ||
| Complement | ||
| Double negation | — | |
| De Morgan | ||
| Distributivity | ||
| Absorption | ||
| Redundancy | ||
| Combining | ||
| Consensus |
The last three are derived laws, shortcuts for a few basic steps. Combining is distributivity followed by complement and identity: . The consensus theorem says that in , the term is redundant: whenever and are both 1, one of the other two terms is already 1, whatever is. The redundancy law is the consensus theorem when one term is a single literal.
How the calculator simplifies
Simplifying by hand is a search: at each point several laws apply, and a bad choice can make the expression longer. The calculator follows a fixed strategy that always reaches the true minimum.
- Remove the extra operators. Constants are folded away, then becomes , becomes , becomes , and NAND and NOR become negated AND and OR.
- Push negations inwards. De Morgan’s laws and double negation are applied until NOT only appears directly on variables. This is called negation normal form.
- Multiply out. AND is distributed over OR until the expression is a sum of products. Products that contain a variable and its negation are 0 and are dropped, and repeated literals are merged.
- Tidy the sum. Repeated products are removed (idempotence), products that contain another product are absorbed, and pairs of products that differ in one variable are combined.
- Reach every prime implicant. Following Blake’s method, the consensus of two products is added whenever it is not already covered, and absorption then removes whatever it covers. At the end of this stage the sum is exactly the set of prime implicants, the products that cannot be shortened.
- Delete redundant products. Prime implicants that the rest already cover are removed one by one, using the consensus theorem where it applies, until the remaining products are the minimal cover that the Quine–McCluskey method picks.
After each step the calculator compares the new expression with the previous one on every row of the truth table, which is the “every step checked” badge. Up to 6 variables you get the whole derivation; with 7 or 8 variables, or when multiplying out would produce more than 96 products, the derivation stops after the negation-normal-form steps and finishes with a single minimisation step, because the algebra would run to hundreds of lines.
Worked example:
This function is 1 on 4 of the 8 rows. The calculator takes 4 steps:
- Distributivity. Multiply out: A ∧ (B ∨ C) = (A ∧ B) ∨ (A ∧ C), until the expression is an OR of ANDs (a sum of products).
- Commutativity. Reorder the literals in each product: A ∧ B = B ∧ A.
- Complement and identity. A ∧ ¬A = 0, so 1 product containing a variable and its negation is 0, and X ∨ 0 = X removes it.
- Consensus theorem (removing a term). XY ∨ ¬XZ ∨ YZ = XY ∨ ¬XZ: B ∧ C is the consensus of A ∧ C and ¬A ∧ B, so it can go.
The answer, , reads naturally: if is 1 the output follows , and if is 0 it follows . It is a two-way multiplexer with as the select line. The term that multiplying out produced is the classic consensus term, and spotting it is the step most hand derivations miss.
Worked example: negations first
For the work is all De Morgan:
- De Morgan’s laws.
- De Morgan’s laws.
- Double negation.
A common slip is to negate only the first operand, writing . De Morgan flips the operator as well as negating both sides.
Common mistakes when simplifying by hand
- Treating OR like addition. , not , and . There is no subtraction or division in Boolean algebra, so you cannot “cancel” a term from both sides of an equation.
- Forgetting the second distributive law. is true in Boolean algebra though false for numbers. It is the quickest way to convert to a product of sums.
- Stopping at a local minimum. has no pair of terms that combine, so it looks finished, but is redundant by consensus. The calculator always checks for consensus terms.
- Assuming the answer is unique. Some functions have more than one minimal form. For example, and are the same function, and both are minimal. If your answer differs from the calculator’s, check that it has the same number of terms and literals, then paste both into the equivalence checker on the truth table generator.
Minimal SOP and POS
A sum of products is what a two-level AND–OR circuit computes: one AND gate per product, one OR gate to combine them. Minimising the number of products minimises the gates, and minimising literals minimises the gate inputs. The product of sums is the OR–AND equivalent. The calculator finds it by minimising the complement of the function, which is 1 exactly where the original is 0, and applying De Morgan to the result. Neither form is always smaller: the parity function needs four products and four sums, while uses three literals as a product of sums but four as the sum of products .
To check an answer row by row, use the truth table generator. To see the same simplification as rectangles on a grid, use the K-map solver. The Boolean algebra explainer covers the theory, and the logic gate simulator lets you build the resulting circuit.
References
- E. J. McCluskey, “Minimization of Boolean functions”, Bell System Technical Journal 35(6), 1956. doi:10.1002/j.1538-7305.1956.tb03835.x
- A. Blake, Canonical Expressions in Boolean Algebra, PhD dissertation, University of Chicago, 1937. The origin of the consensus method used in step 5.
- M. M. Mano and M. D. Ciletti, Digital Design, 6th ed., Pearson, 2018. Chapters 2 and 3.
- “Consensus theorem”, Wikipedia.