Karnaugh Map (K-Map) Solver
Free Karnaugh map solver for 2, 3, 4, 5 and 6 variables. Simplify Boolean logic from a K-map, truth table, expression, minterms or maxterms, with don't-cares, SOP/POS results, step-by-step groups and logic circuits.
Try an example
F = 0
0 ones · 0 don't-cares · 16 zeros
Click a cell to cycle 0 → 1 → X, or hold the button and drag to paint. With the keyboard: arrow keys move, 0 1 X set a value, Space cycles, Page Up/Down switches layers, Ctrl+Z undoes.
Variable namesA B C D
1–3 characters, starting with a letter. Names must be different from each other.
Simplified K-map result
Updates as you edit. Hover a term or a card to see its group on the map.
Set some cells to 1 (or X) in the map above and the simplified expression appears here.
How to use the K-map solver
- Pick the number of variablesChoose 2 to 6. Five and six variables are drawn as several 4×4 layers whose matching cells are neighbours.
- Describe your functionClick cells on the map, fill in a truth table, type a Boolean expression, or list minterms or maxterms. All five views edit the same function.
- Mark don't-caresCycle a cell 0 → 1 → X. A don't-care may be treated as 0 or 1, whichever makes the groups bigger.
- Choose SOP or POSSum of products groups the ones. Product of sums groups the zeros and gives the maxterm form.
- Read the groupsEach coloured outline is one term. The same colour marks the term in the expression and its card, which lists the cells it covers.
- Check, build, exportCompare the result with your input in the verification table, open the logic circuit, step through the algorithm, then export or share.
Key features
2 to 6 variables
Up to 64 cells, with layered maps for 5 and 6 variables.
Five ways to enter a function
Map, truth table, expression, minterm list or maxterm list — switch freely.
Provably minimal
Exact cover search over all prime implicants, with every equally good alternative on offer.
Don't-care aware
X cells enlarge groups but never have to be covered.
Wrap-around groups
Groups across the map edges are drawn as open brackets, the way textbooks show them.
Logic circuit
AND–OR, OR–AND, NAND-only or NOR-only schematics with zoom and gate counts.
Self-checking
Every answer is re-evaluated against your input; a truth table flags any mismatch.
Step-by-step
Quine–McCluskey tables, the prime-implicant chart and Petrick's method.
Export and share
PDF report, PNG/SVG, LaTeX, Verilog, VHDL, C, and a link that reopens your problem.
Private and offline-friendly
Everything runs in your browser. Nothing you enter is uploaded.
Frequently asked questions
What is a Karnaugh map?
A Karnaugh map (K-map) is a grid that lists a Boolean function's truth table so that neighbouring cells differ in exactly one variable. Adjacent ones can then be merged into a single, shorter product term — a visual way to minimise logic.
How many variables does the solver handle?
Two to six. Two, three and four variables use one map. Five variables use two 4×4 maps and six use four; a cell and the cell in the same position on another layer are neighbours when only that layer's variable differs.
What does a don't-care (X) mean?
A don't-care is an input combination that never happens or whose output you do not care about. The solver may count it as 1 to make a group bigger, but it never has to cover it.
What is the difference between SOP and POS?
Sum of products (SOP) is an OR of AND terms and is found by grouping the ones. Product of sums (POS) is an AND of OR terms and is found by grouping the zeros. Both describe the same function; one is sometimes cheaper to build.
Is the answer really minimal?
The solver finds all prime implicants and searches exhaustively for the cover with the fewest terms, then the fewest literals. If a very hard six-variable problem ever exceeds the search budget, the page says the result may not be minimal. Every result is also re-checked against your input.
Is my data sent anywhere?
No. The solver runs entirely in your browser, there are no accounts, and a share link stores the problem in the address itself.
Can I rename the variables?
Yes. Open “Variable names” under the map and give each variable a name of up to three characters; maps, expressions and exports all use them.