K-Map Solver | Karnaugh Map Minimizer (2-4 Variables)
Simplify Boolean functions with interactive Karnaugh Maps.
K-Map Setup
Click on cells to toggle logic values: 0 → 1 → X (Don't Care)
Karnaugh Map (3 Vars)
| 00 | 01 | 11 | 10 | |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 0 |
Select 1's in the grid to calculate the simplified expression.
Working with 'Don't Care' (X) conditions? This tool handles them already. Also try K-Map Solver Pro →
Karnaugh Map Solver and K-Map Calculator: How It Works
This free online k map solver turns a truth table into a simplified Boolean expression. A Karnaugh map (K-map) is a grid version of a truth table. Its rows and columns are labelled in Gray code (00, 01, 11, 10), so neighbouring cells differ in exactly one variable. That makes it easy to see which terms can be combined. Use it as a kmap calculator for homework, or to check your own work by hand. For other methods, see our guide to simplifying Boolean expressions.
How to use the Karnaugh map calculator
- Choose 2, 3 or 4 variables. The map has 4, 8 or 16 cells.
- Click a cell to cycle it through 0, 1 and X (don't care).
- Read the simplified expression the solver gives you.
- To do it by hand, group adjacent 1s into rectangles of 1, 2, 4, 8 or 16 cells. Groups may overlap and may wrap around the edges of the map.
- Make each group as large as possible, and use as few groups as possible.
- Write one product term per group, keeping only the variables that do not change inside the group. Add the terms to get the minimal sum of products (SOP).
K-map simplification examples
Example 1: three variables. F(A,B,C) = Σm(1,3,6,7). The 1s are at A'B'C, A'BC, ABC' and ABC. Grouping m1 with m3 (A = 0, C = 1, B changes) gives A'C. Grouping m6 with m7 (A = 1, B = 1, C changes) gives AB. Result: F = A'C + AB.
Example 2: four variables with don't cares. F(A,B,C,D) = Σm(1,3,7,11,15) + d(0,2,5). The four cells where C = 1 and D = 1 (m3, m7, m11, m15) give CD. The four cells where A = 0 and B = 0 (m0, m1, m2, m3) give A'B', using don't cares 0 and 2 to complete the group. Don't care 5 is not needed, so it is treated as 0. Result: F = CD + A'B'.
Example 3: wrap-around corners. F(A,B,C,D) = Σm(0,2,8,10). The four 1s sit in the four corners of the map. The top and bottom edges are neighbours, and so are the left and right edges, so the corners form one group of four. B = 0 and D = 0 stay constant inside it. Result: F = B'D'.
Common K-map mistakes
- Labelling rows and columns in binary order (00, 01, 10, 11) instead of Gray code (00, 01, 11, 10).
- Making groups of 3, 5 or 6 cells. Group sizes must be powers of two.
- Forgetting that the edges and corners wrap around.
- Using more or smaller groups than necessary, which leaves the expression bigger than the minimum.
Frequently asked questions
Is this k map solver online and free? Yes. It runs in your browser, with no sign-up needed to use the solver.
What are don't care (X) cells? They are input combinations that never occur, or whose output does not matter. Treat an X as 1 if it lets you make a bigger group, and as 0 otherwise.
How do I get the product of sums (POS) form? Group the 0s instead of the 1s. For each group, write a sum of the variables that stay constant, using the plain variable where it is 0 and its complement where it is 1. Then multiply the sums together. You can also convert between the two forms with our SOP/POS calculator.
Can I start from a truth table? Yes. Each row with output 1 is a cell with 1 on the map. If you only need the expression and not the map, use the truth table to Boolean expression converter.
Why does this solver stop at 4 variables? K-maps with more than four variables are hard to read by eye. For five or more variables, tabular methods such as Quine-McCluskey are more practical.