Boolean Algebra
calculator.
Simplify a logic expression or a minterm list to its shortest AND, OR and NOT form.
- Rows that give 1
- 4 of 8
- Kind of function
- Contingency
The output is 1 on 4 of 8 rows. The canonical form needs 4 terms; the minimal form needs 3, built from 3 essential prime implicants.
Karnaugh map
Tap a cell to flip it| A \ BC | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 0 | ||||
| 1 |
Karnaugh map of 3 variables in Gray-code order, rows A, columns BC. Cells with 1: 3, 5, 6, 7.
Truth table, 8 rows
| Row | Inputs A B C | Output |
|---|---|---|
| 0 | 0 0 0 | 0 |
| 1 | 0 0 1 | 0 |
| 2 | 0 1 0 | 0 |
| 3 | 0 1 1 | 1 |
| 4 | 1 0 0 | 0 |
| 5 | 1 0 1 | 1 |
| 6 | 1 1 0 | 1 |
| 7 | 1 1 1 | 1 |
Every form of this function
- Minimal sum of products
- AB + AC + BC
- Minimal product of sums
- (A + B)(A + C)(B + C)
- Canonical sum of products
- A′BC + AB′C + ABC′ + ABC
- Canonical product of sums
- (A + B + C)(A + B + C′)(A + B′ + C)(A′ + B + C)
- Prime implicants
- AB, AC, BC
- Essential prime implicants
- BC, AC, AB
Check another expression
Turn this on to test whether a second expression has the same truth table, for example your own simplification.
Working
- 1Truth table: evaluate every input rowA, B, C: 8 rows, output 1 on 4
- 2Minterms: the rows where the output is 1Σm(3, 5, 6, 7)
- 3Merge terms that differ in one variable, XY + XY′ = X, until none mergePrime implicants: AB, AC, BC
- 4Essential: the only prime implicant covering some mintermBC, AC, AB
- 5Cover every minterm with the fewest terms, then the fewest lettersAB + AC + BC
- 6Check: the minimal form and the input agree on all 8 rowsAB + AC + BC has the same truth table
How it's worked out
The tool first builds the truth table: it tries every mix of 0 and 1 for the variables and records the output. Rows with output 1 are the minterms. For A → B, the output is 0 only when A is 1 and B is 0, so the minterms are rows 0, 1, 3. Levin's open textbook gives that same rule for implication.
Each minterm becomes one AND term that names every variable. That sum is the canonical form, and it is always correct but often long. To shorten it, the Quine-McCluskey method merges two terms that differ in exactly one variable.
Merging repeats until nothing more merges. The terms left over are the prime implicants: no letter can be dropped from them without covering a row where the output is 0. A prime implicant is essential when it is the only one covering some minterm, so every shortest answer must use it. The University of Maryland ENEE 244 lecture notes set this out as a table with one row per prime implicant and one column per minterm.
After the essential terms, the tool tries every set of the other prime implicants and keeps the one with the fewest terms, then the fewest letters. The product of sums comes from the same method run on the rows where the output is 0. The last step checks the result against the input on every row.
A Karnaugh map shows the same thing as a picture. Its rows and columns are in Gray-code order, so cells next to each other differ in one variable, and the map wraps around at its edges. Each term of the shortest answer is a block of 1, 2, 4 or 8 cells.
Worked examples
Amara designs a majority vote circuit
Three judges press a button, and the light turns on when at least two agree. The output is 1 on 4 of the 8 rows, minterms 3, 5, 6, 7.
There are 3 prime implicants and all 3 are essential, since each covers a minterm no other term covers. So nothing can be dropped, and the shortest form is AB + AC + BC. It is the carry output of a full adder.
Jon checks a homework minterm list
His sheet gives F(A, B, C, D) as Σm(0, 1, 2, 3, 5, 7, 8, 10, 14, 15). Merging finds 6 prime implicants: A′B′, A′D, B′D′, ABC, ACD′, BCD.
Only 2 are essential: A′D and B′D′. The four corner cells of the map are one group through the wrap-around, which gives B′D′. Cells 14 and 15 are still open, and the single term ABC covers both, so the shortest form is ABC + A′D + B′D′.
Ken tests whether a term can go
In AB + A′C + BC, when B and C are both 1, either A is 1 and AB is true, or A is 0 and A′C is true. So BC never changes the output. The tool finds 3 prime implicants, 2 of them essential, and gives AB + A′C.
Ken types his own answer as the second expression. The check says the two are equivalent on every row, which is the consensus theorem.
Reading your result
One minimal answer, not the only one. Some functions have two shortest forms with the same count of terms and letters, where two groups could each cover a leftover cell. Both are right. Use the second expression to check yours.
Fewer terms means fewer gates. Each AND term is an AND gate and the sum is one OR gate. 4 canonical terms for A′B′C′ + A′BC′ + AB′C′ + ABC′ shrink to C′, a single inverter.
XOR stays as it is. A XOR B has no shorter two-level form than AB′ + A′B, though one XOR gate does the job. The tool only uses AND, OR and NOT.
The kind of function. A tautology is true on every row, a contradiction on none, and anything else is a contingency. Both De Morgan's law for (A + B)′ and the absorption law A + AB = A pass the equivalence check, as they should.
Common mistakes
- Reading the map in plain binary order. The columns go 00, 01, 11, 10, so that neighbors differ in one bit. Writing them as 00, 01, 10, 11 joins cells that should not group.
- Missing the wrap-around. The left and right edges touch, and so do the top and bottom. The four corners of a 4-variable map can form one group.
- Groups that are not a power of two. A block of 3 or 6 cells is not one term. Split it into blocks of 2 or 4.
- Mixing up the converse. A → B and B → A are not the same. They differ when A is 0 and B is 1.