Boolean Algebra Simplifier
Enter a Boolean expression or a list of minterms and get its minimal sum of products (SOP) and product of sums (POS). The tool finds them with the Quine–McCluskey method, lists the prime implicants and checks the result against the truth table.
Function
Digital-logic notation: AB means A AND B,
A' means NOT A, + means OR. Logic notation: ¬ ∧ ∨ → ↔
or the words not and or xor. The full list is in the table at the bottom of
the tool.
Separate the numbers with commas or spaces; a range such
as 8-11 also works. With n variables the rows are numbered
from 0 to 2n − 1.
Everything is computed in your browser – nothing you type is sent to a server.
Minimal forms and cost
| Form | Terms | Literals |
|---|
A literal is one occurrence of a variable, complemented or not. Terms are product terms in an SOP and sum terms in a POS. The minimal forms have the fewest terms and, among those, the fewest literals.
The minimal forms appear here as soon as the input is valid.
Prime implicants
| Pattern | Term | Rows covered | Essential | Used |
|---|
Prime implicant chart
The prime implicants appear here as soon as the input is valid.
Working: the merging tables
Show the Quine–McCluskey merging tables
The merging tables appear here as soon as the input is valid.
Check
The truth table appears here as soon as the input is valid.
Notation
| Operation | Digital logic | Logic | Or type |
|---|---|---|---|
| NOT | A' | ¬A | !A ~A not |
| AND | AB, A·B | A ∧ B | * & and |
| XOR | A ⊕ B | A ⊕ B | ^ xor |
| OR | A + B | A ∨ B | | or |
| IMPLIES, IFF | →, ↔ | →, ↔ | -> <-> implies iff |
| Constants | 0, 1 | 0, 1, T, F | true false |
Operations are applied from the top of the table
down: NOT first, then AND, XOR, OR and last the two arrows. In digital-logic notation
every letter is one variable, so letters written together are multiplied; words such as
and work in logic notation only, where a name may have several characters
(x1, carry) and AND must be written out. Capital T
and F are the constants true and false in logic notation only; in
digital-logic notation they are ordinary variables.
How to use the Boolean algebra simplifier
- Choose the input: an expression or a list of minterms.
- Type the expression. In digital-logic notation letters side by side mean AND, an
apostrophe means NOT and
+means OR, as inA'B + AC; logic notation uses¬ ∧ ∨or the wordsnot and or. "Auto" recognises which one you typed. - For minterms, name the variables, list the rows where the function is 1 and, if there are any, the don't-care rows. The first variable is the most significant bit.
- Read the minimal SOP and POS and copy the notation you need.
- Below are the prime implicants, the merging tables and the checking truth table.
How it works
Simplifying a Boolean expression means finding a shorter expression with the same truth table. In a circuit every product term is an AND gate and every literal a gate input, so fewer terms and literals mean fewer and smaller gates: a cheaper circuit that uses less power.
This tool does not apply algebra laws one after another and prints no chain of algebraic steps. It evaluates the function for every row and then finds the smallest two-level form with the Quine–McCluskey (tabular) method:
- Write each minterm in binary and group the minterms by their number of 1s.
- Merge every pair that differs in exactly one bit. The bit becomes a dash, which removes that variable. Repeat with the merged terms until nothing merges. Every term that was never merged is a prime implicant.
- Build the prime implicant chart. A prime implicant that is the only one covering some minterm is essential and must be used.
- Cover the remaining minterms with as few prime implicants as possible. An exact branch-and-bound search minimises first the number of terms, then the number of literals.
A small example: f(A, B, C) = Σm(1, 3, 5, 6, 7), in binary
001, 011, 101, 110 and 111. The first round gives 0-1, -01,
-11, 1-1 and 11-. In the second round
0-1 merges with 1-1, and -01 with -11,
into --1. The prime implicants are --1, which is C,
and 11-, which is AB. Minterm 1 is covered only by
C and minterm 6 only by AB, so both are essential and
f = AB + C.
For the POS the tool minimises the zeros of the function in the same way and applies De Morgan's laws to the result.
Examples
Absorption. A + AB simplifies to A: whenever
AB is 1, A is already 1.
Consensus. AB + A'C + BC gives the SOP
AB + A'C – three terms and six literals become two terms and four literals –
and the POS (A + C)(A' + B).
XOR. A ⊕ B gives AB' + A'B and the POS
(A + B)(A' + B'), two terms and four literals each.
Don't-cares. For A, B, C, D with minterms 1, 3, 7, 11, 15 and
don't-cares 0, 2, 5 the tool reports two minimal forms, A'B' + CD and
A'D + CD. Without the don't-cares the best result is
A'B'D + CD.
The laws of Boolean algebra
The identities used when simplifying by hand; most come in an OR and an AND version:
- Identity:
A + 0 = A,A·1 = A - Null:
A + 1 = 1,A·0 = 0 - Idempotent:
A + A = A,AA = A - Complement:
A + A' = 1,AA' = 0 - Absorption:
A + AB = A,A(A + B) = A - De Morgan:
(AB)' = A' + B',(A + B)' = A'B' - Distributive:
A(B + C) = AB + AC,A + BC = (A + B)(A + C) - Consensus:
AB + A'C + BC = AB + A'C
SOP, POS, minterms and maxterms
A sum of products (SOP) is an OR of AND terms, such as
AB + A'C: AND gates feeding one OR gate. A product of sums
(POS) is an AND of OR terms, such as (A + C)(A' + B). Which one is cheaper
depends on the function.
A minterm is a product of all variables that is 1 in exactly one row.
A maxterm is a sum of all variables that is 0 in exactly one row. Rows
are numbered by reading the variables as a binary number, so Σm(1, 3) lists
the rows where the function is 1 and ΠM(0, 2) the rows where it is 0.
Implicants and prime implicants
An implicant is a product term that is 1 only in rows where the function is 1 or a don't-care. It is a prime implicant when no literal can be removed from it without breaking that rule. An essential prime implicant is the only prime implicant covering at least one minterm, so every minimal SOP contains it.
Don't-cares and several minimal forms
A don't-care is an input combination that never occurs, or whose output does not matter – for example the codes 10 to 15 in a circuit for decimal digits. The method may treat such a row as 1 when that makes an implicant larger, but it does not have to cover it.
A function can have several equally small forms. Σm(0, 1, 2, 5, 6, 7) over
A, B, C has six prime implicants and none is essential; the three-term covers
AC + A'B' + BC' and AB + A'C' + B'C are both minimal. The tool
counts such forms and lists up to eight.
Limits of two-level minimisation
The result is minimal only among two-level forms. Factoring into more levels can be
smaller: ABC + ABD + E is a minimal SOP with seven literals, and its minimal
POS (A + E)(B + E)(C + D + E) has seven too, yet the factored form
AB(C + D) + E needs only five. XOR-heavy functions are the worst case: the
parity of four variables needs eight four-literal terms as an SOP but only three XOR
gates.
Up to five variables the result is always exact. With six to eight (the maximum), the cover search gives up after a fixed number of steps; if that happens, the tool shows a correct form found by a greedy heuristic and says that it may not be minimal.
Frequently asked questions
Does the tool show the algebra steps?
No. It shows the working of the tabular method – merging tables, prime implicants, chart – and proves the answer with a truth table, but not which law turns one line into the next.
Why does my textbook give a different answer?
Often the function has several minimal forms; check the list of alternatives. Your answer may also be factored into more than two levels, or not be minimal. To test whether two expressions are equivalent, compare them in the Truth Table Generator.
Is this the same as a Karnaugh map?
The result is the same. A Karnaugh map shows prime implicants as groups of adjacent cells and works by eye up to four or five variables; the tabular method searches systematically.
Why is AB read as "A AND B"?
In digital-logic notation variables are single letters, so letters written together
are multiplied. For longer names such as x1 or carry, set the
notation to Logic and write the operators out: x1 ∧ carry.
Is my expression sent anywhere?
No. Everything is computed in your browser and nothing is uploaded. Your last input is kept only in this browser's local storage.
Related tools
- Truth Table Generator – the full truth table of any expression, equivalence checks, canonical DNF and CNF.
- Two's Complement Calculator – signed binary numbers, binary addition and subtraction.
- Subnet Calculator – network, broadcast address and host range of an IPv4 subnet.
- Neural Network Playground – watch a small neural network learn to separate points.