Build a Karnaugh map by clicking cells or typing minterms and don't-cares, and get the minimal sum-of-products or product-of-sums expression instantly. Every group is outlined on the map in its own color, including groups that wrap around the edges.
Last updated:
Variables
Click a cell to cycle 0 → 1 → X (don't care). With a cell focused, type 1, 0 or X, and use the arrow keys to move.
Truth table and canonical forms
Advertisement
Advertisement
How to use the Karnaugh Map Solver
Choose the number of variables (2 to 6) and, if you like, rename them (for example X Y Z or S1 S0 EN).
Fill the map: click cells to cycle 0 → 1 → X, or type the minterms and don't-cares (ranges like 10-15 work) and press Solve.
Read the answer: the minimal expression appears on the right and every group is outlined on the map in the matching color.
Switch to POS to group the zeros and get the minimal product of sums instead.
Copy the expression in the notation you need, or open the truth table to check each row.
Karnaugh map layouts and minterm numbering
Minterm numbers come from reading the variables as a binary number with the first variable as the most significant bit, so with A, B, C, D the cell A=1, B=0, C=1, D=1 is minterm 1011₂ = 11. Rows and columns follow the Gray code 00, 01, 11, 10, which is why minterms 2 and 3 appear in swapped order on the map.
Variables
Map layout
Rows × columns
Cells
Largest group
2
A down, B across
2 × 2
4
4 (F = 1)
3
A down, BC across
2 × 4
8
8
4
AB down, CD across
4 × 4
16
16
5
two 4 × 4 maps (A = 0, 1); BC down, DE across
2 × (4 × 4)
32
32
6
four 4 × 4 maps (AB = 00, 01, 11, 10); CD down, EF across
4 × (4 × 4)
64
64
Grouping rules
Groups must be rectangles whose size is a power of two: 1, 2, 4, 8, 16 or 32 cells.
The map wraps around: the left edge touches the right edge and the top touches the bottom, so the four corners of a 4×4 map form one group.
Make every group as large as possible (these are the prime implicants) and use as few groups as possible to cover every 1.
Groups may overlap, and they may include don't-care cells, but no group may contain a 0 (or a 1 when grouping zeros for POS).
A group of 2k cells removes k variables: in a 4-variable map, a pair gives a 3-literal term, a quad 2 literals and an octet 1 literal.
Worked example: for the default map m(0, 1, 2, 5, 6, 7, 8, 9, 10, 14) the solver finds F = B'C' + CD' + A'BD: three terms and seven literals. B'C' is a quad that wraps from the top row to the bottom row (cells 0, 1, 8, 9), CD' is the whole right-hand column (cells 2, 6, 10, 14), and A'BD picks up the remaining pair 5 and 7.
Frequently asked questions
What is a Karnaugh map?
A Karnaugh map (K-map) is a grid of a Boolean function's truth table arranged in Gray-code order, so that neighboring cells differ in exactly one variable. Groups of 1, 2, 4, 8, 16 or 32 adjacent 1-cells correspond to product terms where the variables that change are eliminated, which makes it easy to find a simplified expression by eye. Maurice Karnaugh introduced it in 1953.
How does the solver find the minimal expression?
It runs the Quine–McCluskey method to list every prime implicant (the largest possible groups), picks the essential prime implicants that are the only cover for some 1-cell, and then searches all remaining combinations to find the cover with the fewest terms and, among those, the fewest literals. That is the same answer you aim for with careful grouping on the map, without the risk of missing a wrap-around group.
What are don't-care conditions?
Don't-cares (X) are input combinations whose output does not matter, usually because they can never occur, such as the BCD codes 10 to 15. The solver may include them in a group when that makes the group bigger, but it never needs to cover them, which often gives a simpler circuit.
How do 5 and 6 variable K-maps work?
A 5-variable map is drawn as two 4×4 maps for A = 0 and A = 1, and a 6-variable map as four 4×4 maps for AB = 00, 01, 11 and 10. Cells in the same position on neighboring maps are adjacent, so a group can span maps. The solver handles this automatically and outlines each group on every map it touches.
What is the difference between SOP and POS?
Sum of products (SOP) ORs together AND terms and is found by grouping the 1s, for example F = AB' + C. Product of sums (POS) ANDs together OR terms and is found by grouping the 0s, for example F = (A + C)(B' + C). Both describe the same function; which is smaller depends on the function, and POS maps naturally to NOR-NOR logic while SOP maps to NAND-NAND.
Why are there several minimal answers?
Some functions have more than one cover with the same number of terms and literals, typically when a 1-cell can be covered by two different prime implicants of the same size. All of them are equally minimal; use Show another solution to step through them.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.