Simplify a Boolean function with a Karnaugh map
This K-map solver turns a set of true input combinations into a minimum sum-of-products expression. Choose a two-, three- or four-variable map, click the cells that should produce a true output, and read the expression below it. The result updates after each click, which makes it useful for checking digital logic homework or exploring how a pattern of minterms simplifies.
The interface starts with a four-variable example. It labels the variables A, B, C and D and shows each cell's minterm number beneath its current value. You can copy the resulting expression with the copy control. The map does not draw grouping loops or show a sequence of hand-simplification steps; use the result alongside your own grouping diagram when your assignment requires the working.
Read the map axes and minterm numbers
A truth table normally lists input combinations in binary counting order. A Karnaugh map rearranges those combinations into Gray code order so neighboring cells differ in only one variable. Where an axis has two bits, its labels read 00, 01, 11, 10. Do not enter cells by counting across the screen as if the columns were ordinary binary order.
For two variables, the row is A and the column is B. For three variables, the row is A and the columns are BC. For four variables, the rows are AB and the columns are CD. In every case A is the most significant bit of the minterm number. The small m-label is the quickest way to match a list from a textbook with the right cells.
The map has 4, 8 or 16 cells for two, three or four variables respectively. Changing the variable count clears the selection, so choose the size before entering a function. An unselected cell means a required zero, rather than a value the solver is free to ignore.
The sum-of-products notation
A product term combines literals with AND. A literal is a variable or its complement, so A'C means NOT A AND C. A sum joins product terms with OR, so A'C + BC means that either product may make the output true. The prime mark after a letter means complement; it is unrelated to the derivative notation used in calculus.
A hand grouping eliminates variables that change inside a valid group. The solver computes prime implicants with Quine–McCluskey and searches their covers exactly. Its objective is the fewest product terms, then the fewest literals among covers with that term count. If several covers tie, the displayed expression is one valid optimum rather than a list of every equivalent answer.
This objective concerns a sum-of-products formula. It does not optimize an arbitrary multilevel circuit, account for available gate packages or produce a product-of-sums form. A factored implementation can look different while expressing the same function.
Worked example: the default four-variable map
The default selected minterms are 0, 1, 4, 5, 12 and 13. The following binary assignments and the resulting expression were checked using the tool's Boolean libraries. All other input combinations must produce zero.
| Minterm | ABCD | Required output |
|---|---|---|
| m0 | 0000 | 1 |
| m1 | 0001 | 1 |
| m4 | 0100 | 1 |
| m5 | 0101 | 1 |
| m12 | 1100 | 1 |
| m13 | 1101 | 1 |
The minimum result is F = A'C' + BC'. The first term covers minterms 0, 1, 4 and 5; the second covers 4, 5, 12 and 13. Overlap is allowed, so the shared cells do not cause a problem. D disappears because changing D never changes the required output within either group.
Compare the formula with your own grouping before copying it into a report. In particular, check that each product covers only selected cells and that every selected cell is covered by at least one product. Those two checks establish the required truth table even when the expression's term order differs from your answer.
Wrap-around adjacency and common mistakes
The left and right edges are adjacent, as are the top and bottom edges where the axis has multiple rows. Corners may therefore belong to the same rectangular wrap-around group. Diagonal contact alone is not adjacency. When checking a map by hand, use rectangular groups whose cell counts are powers of two and avoid groups that contain a required zero.
Do not treat a blank-looking or unclicked cell as a don't-care. This interface toggles only between zero and one; there is no X entry. It also accepts input through cell clicks, not by pasting a minterm list or entering a Boolean formula. Retain your original list separately so you can check the selection after editing.
Selecting no cells yields F = 0, while selecting every cell yields F = 1. These are constant functions and need no variable terms. For ordinary functions, a different-looking expression may still be equivalent, especially when multiple minimum covers exist.
Verify the result and continue
Use the truth table generator to compare a formula with the selected minterms. Its NOT syntax is prefix ! rather than an apostrophe, so translate A'C' + BC' to !A*!C + B*!C and omit the leading F = when entering it. The truth-table interface does not automatically import the map selection.
For the reasoning behind the layout, read the Karnaugh map simplification guide. To review the operators individually, try the logic gate simulator or the logic gates and truth tables guide.