Minimize Boolean expressions instantly — click cells to toggle minterms and don't-cares, and see the minimized SOP with color-coded prime implicant groups. Supports 2, 3, and 4 variables.
Each cell in the K-map corresponds to one minterm — a unique input combination. Click to set a cell to 1 (function outputs true), 0 (false), or X (don't-care). You can also type minterm numbers directly in the fields below the map and click Load.
② Form Maximal Groups
The solver finds all prime implicants — the largest possible rectangles of 1s and Xs with a power-of-2 cell count (1, 2, 4, 8, 16). Groups wrap around all four edges. A larger group means fewer literals: a group of 4 eliminates 2 variables from the product term.
③ Find Essential Prime Implicants
An essential prime implicant (EPI) is the only group covering a particular minterm. EPIs are always included in the minimal solution. After locking in EPIs, remaining uncovered minterms are covered greedily with the largest available prime implicants.
④ Read the SOP Expression
Each selected group becomes one AND-term. Variables fixed at 0 appear complemented (A'), variables fixed at 1 appear uncomplemented (A), variables that change within the group are eliminated. The terms are OR-ed to form the final SOP.
Group Size
Variables Eliminated
Literals in Term
Example (4-var)
1 cell
0
4
A'B'C'D'
2 cells
1
3
A'B'C'
4 cells
2
2
A'B'
8 cells
3
1
A'
16 cells
4
0
1 (always true)
Frequently Asked Questions
What is a Karnaugh map and why is it used?
A Karnaugh map (K-map) is a graphical tool for simplifying Boolean expressions. It arranges all truth table rows in a grid where adjacent cells differ by exactly one variable (Gray code ordering). Grouping adjacent 1s in the grid corresponds to factoring shared variables out of a product term, directly giving the minimized Sum of Products (SOP). K-maps are universally taught in digital electronics and asked in VLSI/ASIC interviews because they build intuition for logic minimization.
How do I solve a 4-variable Karnaugh map step by step?
① Fill the 4×4 grid with your truth table values (0, 1, or X). The rows represent AB (in Gray code 00→01→11→10) and columns represent CD. ② Circle all maximal groups of 1s and Xs — start with the largest possible groups (16, 8, 4, 2, 1). Groups wrap around all edges. ③ Identify essential prime implicants — any minterm covered by only one group makes that group essential. ④ Cover remaining minterms with the fewest additional groups. ⑤ Write one AND-term per group: include only variables that are constant within the group. OR all terms together for the final SOP.
What are don't-care conditions (X) in K-maps?
Don't-care conditions (marked X) are input combinations that either cannot occur in the real system or whose output value doesn't matter. In a BCD digit detector, for example, binary values 10–15 are invalid and can be marked X. In K-map minimization, don't-cares act as wildcards — they can be included in groups to form larger rectangles and eliminate more variables. However, a group made entirely of don't-cares is never selected, since it doesn't contribute to covering any actual minterm.
Why must K-map groups be powers of 2?
The Gray code ordering of the K-map ensures that any rectangular group of 2ⁿ adjacent cells (1, 2, 4, 8, …) has exactly n variables that change across the group. Those n changing variables cancel out, leaving a product term with (total_variables − n) literals. If a group size is not a power of 2, the variables cannot be cleanly eliminated, so you'd end up with a more complex or incorrect expression. The power-of-2 constraint is what makes K-maps a sound minimization method.
What is the difference between POS and SOP simplification?
Sum of Products (SOP) groups the 1s in the K-map to produce AND terms OR-ed together — implementing a two-level NAND-NAND network. Product of Sums (POS) instead groups the 0s (maxterms) and applies De Morgan's law to get OR terms AND-ed together — implementing a NOR-NOR network. This solver uses SOP. For some functions, POS gives fewer gates, but in practice, synthesis tools evaluate both and choose the more economical form automatically.
Can K-maps solve 5 or 6 variable functions?
Yes, but they require two overlapping 4-variable K-maps side by side. For 5 variables (ABCDE), one map covers E=0 and the other E=1; a group is valid only if the same pattern of 1s appears in both maps. At 6 variables, four 4-variable maps are needed, making the visual method very unwieldy. Beyond 6 variables, the Quine-McCluskey (tabulation) algorithm or the ESPRESSO heuristic are used by synthesis tools. For VLSI interview purposes, 4-variable K-maps are the most commonly tested form.