← Digital logic calculators

DIGITAL LOGIC / BOOLEAN MINIMIZATION

Karnaugh Map Solver and Interactive K-Map Calculator with Steps

Use this Karnaugh map calculator as a visual K-map solver and Boolean simplifier. Enter minterms, don’t-cares, a truth table or an expression to find every minimal SOP and POS form, inspect the colored groups and translate the result into a logic circuit.

Enter a Boolean function

Use commas, spaces or ranges such as 4-7.

Worked Karnaugh map examples

These examples cover the grouping decisions that cause the most mistakes. Open any case to inspect its map, colored groups, exact cover and circuit forms.

Wraparound corner group

F(A,B,C,D) = Σm(0,2,8,10)

The four corner cells form one group: F = B′D′.

Opposite edges are adjacent in Gray-code order; corners are not isolated.

Load wraparound example →

Overlapping groups

F(A,B,C) = Σm(1,3,5,6,7)

Two groups overlap at m7, producing F = C + AB.

Overlap is valid when it lets every group remain as large as possible.

Load overlap example →

Using a don’t-care

F = Σm(1,3,7) + d(5)

Using d5 completes a four-cell group, reducing the function to F = C.

A don’t-care is optional, but here it removes two literals.

Load don’t-care example →

Minimum POS from zero groups

F = Σm(1,2,3,5,7)

The minimum POS is (B + C)(A′ + C).

POS groups the 0-cells rather than the 1-cells, but represents the same function.

Load POS example →

Alternative minimum covers

F = Σm(0,2,3,4,5)

B′C′ + A′B + AB′ and A′C′ + A′B + AB′ tie.

Different groups can have the same minimum term and literal counts.

Load alternative covers →

Static-1 hazard

F = AB + A′C

The minimum SOP can glitch when A changes; adding consensus term BC makes it hazard-resistant.

The extra group overlaps the two original implicants across the transition.

Load hazard example →

How to use the K-map solver

Choose minterms when you know the 1-row indices, paste a truth-table output column when working from data, or enter an expression when starting from Boolean algebra. For two through five variables, you can also click cells to cycle through 0, 1 and X.

How a Karnaugh map solver simplifies Boolean logic

A Karnaugh map uses Gray-code order, so horizontally or vertically adjacent cells differ in one input. Combining adjacent cells into groups of 1, 2, 4, 8 or more removes the variables that change inside each group. Opposite edges are adjacent, which is why the four corners can form one group.

K-map grouping rules

  • Cover every required 1-cell for SOP or every required 0-cell for POS.
  • Use rectangular groups containing a power of two cells.
  • Make groups as large as possible without including the wrong value.
  • Allow overlap when it reduces the expression or covers an essential cell.
  • Use a don’t-care when helpful; it never has to be covered.

SOP, POS and don’t-care terms

Grouping 1s produces sum of products, while grouping 0s produces product of sums. A don’t-care can take either value when that creates a simpler circuit. In a BCD decoder, inputs 1010 through 1111 do not represent decimal digits and may be marked X when their outputs are unspecified.

Prime and essential prime implicants

A prime implicant is a valid group that cannot be expanded. It is essential when it covers a required cell no other prime implicant covers. Essential implicants must appear in every valid minimum cover; the chart shows these coverage obligations.

Why this solver uses an exact method

A visual K-map is practical for two through five variables. The engine uses Quine–McCluskey tabulation and exact minimum-cover search through eight variables, reporting alternative solutions tied for the fewest terms and literals.

Worked four-variable K-map example

Consider F(A,B,C,D) = Σm(0,2,5,7,8,10,13,15) with don’t-cares d(1,9).

  1. Group m0, m2, m8 and m10. B and D remain 0, giving B′D′.
  2. Group m5, m7, m13 and m15. B and D remain 1, giving BD.
  3. Combine the terms: F = B′D′ + BD.

The equivalent POS form is (B + D′)(B′ + D). The don’t-cares are available but are not needed.

Why two minimal answers can both be correct

Some prime-implicant charts can be covered in several ways with the same term and literal counts. Those expressions are equivalent even though their groups differ. Use the solution selectors to inspect each minimum cover.

K-map, Boolean algebra or exact tabulation?

Use the truth table generator to evaluate a function, this page for visual grouping, or the Boolean algebra simplifier when symbolic reduction is central. Exact tabulation helps when a function is too large to inspect reliably by eye.

Where Karnaugh maps are used

K-maps are used for decoders, multiplexers, control logic, small state machines, seven-segment displays and introductory FPGA or PLD designs. Fewer literals can mean fewer gate inputs, less wiring and lower propagation depth.

Common K-map mistakes

  • Reading columns in binary instead of Gray-code order.
  • Missing wraparound adjacency or making diagonal groups.
  • Using groups of 3, 6 or another non-power-of-two size.
  • Choosing small groups when a larger group removes more literals.
  • Treating every don’t-care as mandatory.
  • Assuming the first valid cover is the only minimum answer.

Static hazards and consensus terms

A minimal expression can glitch when inputs do not change simultaneously. Hazard analysis identifies consensus terms that create a shared group for static-1 SOP or static-0 POS protection.

From a K-map calculator to a logic circuit

SOP maps to AND–OR and NAND-only logic. POS maps to OR–AND and NOR-only logic. The diagram, gate count and depth help compare covers, while Verilog and VHDL provide a starting point for implementation.

Karnaugh map solver frequently asked questions

Is a K-map solver the same as a Karnaugh map calculator?

Yes. K-map solver, K-map calculator and Karnaugh map calculator usually describe a tool that places Boolean outputs on a Karnaugh map and finds simplified expressions.

How is a Karnaugh map solver different from a Boolean simplifier?

A Boolean simplifier may return only a reduced expression. A K-map solver also shows the Gray-code grid and the groups responsible for each implicant, making the simplification easier to inspect.

Can a K-map group cross an edge?

Yes. Opposite edges are adjacent because their Gray-code labels differ in one bit. The four corner cells can therefore form one group.

Should I always make the largest possible groups?

Prefer larger valid groups because they remove more literals, but every required cell must still be covered. Overlapping groups can be necessary for a minimum result.

What is the difference between SOP and POS?

SOP groups 1-cells and joins product terms with OR. POS groups 0-cells and joins sum clauses with AND. Both represent the same truth table.

How should don’t-care cells be used?

Include a don’t-care when it helps create a larger group or a simpler expression. Otherwise leave it unused.

What happens above five variables?

The exact engine continues through eight variables using tabulation and minimum-cover search, but the visual K-map is omitted because higher-dimensional maps are difficult to read reliably.