Karnaugh Map Solver (K-Map Calculator)
Simplify Boolean functions instantly using K-Maps, truth tables, Boolean expressions, minterms, or maxterms. Get exact SOP/POS results step by step.
How would you like to define your K-map?
Click cells to toggle between 0, 1, and X (don't care)
Simplified K-Map Result
Map Groupings
The function is constant; the entire map or no cells are grouped.
Simplified Expression
F = 0
Original Groups Breakdown
- Terms
- 0
- Literals
- 0
- Gates
- 0
Gate-Level Circuit Diagram
Synchronized Truth Table
Updates automatically based on your Karnaugh Map input.
How it works
From a boolean function to a minimized, gate-level circuit in four steps.
Choose your variables
Pick 2, 3, 4, or 5 variables to match the boolean function you're minimizing.
Enter your function
Type a boolean expression, list minterms or maxterms, or fill in the truth table directly.
Read the grouped map
Pairs, quads, and octets are outlined automatically as the solver finds the largest valid groups.
Get the minimized result
Copy the simplified SOP or POS expression, view the gate-level circuit, or export a PDF.
What you'll see
A preview of the tool's main views. Scroll to browse.
How to Use the Karnaugh Map Solver
The Karnaugh Map Solver helps you simplify Boolean functions with 2 to 5 variables. You can start with the form of the problem you already have instead of converting everything by hand. If you are new to the method, our guide on what a Karnaugh Map is explains how the grid, Gray-code adjacency, and basic simplification fit together.
Choose the number of variables, then enter the function using the K-Map, truth table, Boolean expression, minterms, or maxterms. These inputs represent the same Boolean function, so changes in one view are reflected in the others.
On the K-Map, click a cell to move between 0, 1, and X. Use X when the problem includes a don't-care condition.
If your function is given as minterms, you can enter a form such as:
Σm(1,3,5,7)
For maxterms:
ΠM(0,2,4,6)
You can also type a Boolean expression and use the generated truth table and K-Map to check the output for each input combination.
After entering the function, choose SOP or POS and view the simplified result.
K-Map Calculator Results
This K-Map Calculator shows more than a final Boolean expression. It also helps you see how the minimized result is connected to the map.
The output can include the simplified expression, highlighted K-Map groups, term and literal information, gate count, and a gate-level circuit diagram.
This is useful when you want to check not only the answer, but also how the answer was formed.
SOP and POS Simplification
SOP (Sum of Products) works from the input combinations where the Boolean function equals 1.
A simplified SOP expression may look like:
A'B + BC
POS (Product of Sums) works from the combinations where the function equals 0.
A POS result may look like:
(A + B')(B + C)
Both forms can describe the same Boolean function. Which one is more useful depends on the problem and the circuit you want to build.
Understanding K-Map Groups
Karnaugh map simplification works by grouping adjacent cells in powers of two:
1, 2, 4, 8, 16
Larger valid groups usually remove more changing variables from the expression.
K-Maps also wrap around their edges. A cell on the left side can be adjacent to one on the right side, and the top and bottom edges work the same way. Because of this, corner cells can sometimes form a valid group.
Groups may also overlap. That is not necessarily an error. In some functions, overlapping groups are needed to cover the required cells with fewer terms or literals.
The highlighted groups in the solver make it easier to compare the visual K-Map with the final Boolean expression. For a detailed breakdown of pairs, quads, octets, overlap, and wrap-around rules, see our complete guide to Karnaugh Map grouping rules.
Don't-Care Conditions
A don't-care condition is shown as X.
It means the output for that input combination does not have to be fixed as 0 or 1.
A don't-care may be included when it helps form a larger K-Map group and create a simpler expression. If it does not help, it can be ignored.
For example, three neighboring 1 cells cannot form a valid group of three. If a nearby X allows them to form a group of four, the don't-care can be used.
The important point is that X is optional. It is not a required 1 or a required 0.
Boolean Simplification with Quine-McCluskey
A Karnaugh map is a visual way to simplify logic, but finding the best grouping by hand becomes harder as the function grows.
This solver uses the Quine-McCluskey algorithm to perform Boolean simplification systematically.
Quine-McCluskey compares compatible terms and combines terms that differ in only one relevant bit. The process continues until the function's prime implicants have been identified.
A prime implicant is a valid implicant that cannot be expanded further.
Some prime implicants are essential prime implicants. These cover a required minterm that no other prime implicant covers.
This gives the solver a structured way to find the important terms in a Boolean function instead of depending only on a visual guess.
What Petrick's Method Does
Sometimes the essential prime implicants do not cover every required minterm.
When that happens, there may be several possible combinations of remaining prime implicants.
Petrick's Method is used to analyze these remaining covers and determine which combinations can complete the minimized result.
This is especially useful for Boolean functions where several K-Map groupings appear possible and the smallest expression is not obvious from the map alone.
Together, Quine-McCluskey and Petrick's Method provide a systematic approach to SOP and POS minimization.
2 to 5 Variable K-Maps
The solver supports 2 variable K-Map, 3 variable K-Map, 4 variable K-Map, and 5 variable K-Map problems.
A 2-variable K-Map has 4 cells and is useful for learning basic grouping.
A 3-variable K-Map has 8 cells and makes edge wrapping easier to see.
A 4-variable K-Map has 16 cells and is common in digital logic exercises. At this size, a function may contain several possible groups and overlapping implicants.
A 5-variable K-Map represents 32 input combinations. Manual grouping can become much harder here, especially when the function contains several prime implicants or don't-care conditions.
The solver keeps the K-Map, truth table, Boolean expression, minterms, maxterms, and minimized result connected to the same function.
Minterms, Maxterms, and Truth Tables
A Boolean function can be described in several equivalent ways.
A minterm represents an input combination where the function output is 1.
For example:
F(A,B,C) = Σm(1,3,5,7)
means the output is 1 for minterms 1, 3, 5, and 7.
A maxterm represents an input combination where the function output is 0.
For example:
F(A,B,C) = ΠM(0,2,4,6)
identifies the zero-output rows.
A truth table lists every possible input combination and its output. The K-Map rearranges the same combinations in Gray code order so that adjacent values can be grouped.
If your problem starts with a truth table, you can enter the values directly instead of converting every row manually. For a step-by-step walkthrough, see our tutorial on how to convert a truth table to a Karnaugh Map.
Boolean Expression to K-Map
You can also start with a Boolean expression.
The expression is evaluated for the selected variables, and the corresponding outputs are used to build the truth table and Karnaugh map.
This lets you compare several views of the same function:
- Boolean expression
- truth table
- minterms
- maxterms
- K-Map
- minimized SOP or POS result
Seeing these forms together can make it easier to check whether a simplification is correct.
Logic Circuit and Gate Count
A minimized Boolean expression is often used to build a logic circuit.
The solver can generate a gate-level circuit diagram based on the simplified expression so you can see how the result maps to logic gates.
It also shows information such as the number of terms, literals, and gates.
For example:
A'BC
contains one term and three literals.
Reducing unnecessary terms and literals can make a Boolean expression easier to read and can also produce a simpler logic implementation.
Step-by-Step PDF Export
The solution can be exported as a PDF for later review.
The PDF can include the Karnaugh map, selected groups, simplified result, working steps, and circuit representation.
This is useful when you want to keep a solved example, review your work later, or compare the result with a hand-worked K-Map.
SOP vs POS: Which Should You Use?
Use SOP when you want to simplify the conditions where the function output is 1.
Use POS when you want to simplify the conditions where the function output is 0.
Neither form is always shorter.
Some Boolean functions have a smaller SOP expression, while others may have a simpler POS form.
If your problem does not require one specific format, comparing both can help you choose the cleaner representation.