Home › Tools › K-Map Solver

K-Map Solver

Simplify boolean logic expressions and visualize groupings with Karnaugh maps. Calculate simplifications directly on your device.

Number of variables
Click cell to cycle: 0 → 1 → X
AB \ CD00011110
00m0Xm11m31m2X
01m40m50m71m60
11m120m130m151m140
10m80m90m111m100

Or specify minterms & don't cares

Minimal Sum of Products (SOP)
F = A'B' + CD
Minimal Product of Sums (POS)
F = (B' + C)(D)(A' + C)

Prime Implicant Groupings (SOP)

GroupTermBinary CoverCovered Cells
#1A'B'00--{0, 1, 2, 3}
#2CD--11{3, 7, 11, 15}

About this tool

K-Map Solver simplifies boolean logic equations using 2-variable, 3-variable, and 4-variable Karnaugh maps. By organizing minterms in adjacency Gray-code grids (00,01,11,1000, 01, 11, 10), the solver groups contiguous powers of two (1,2,4,8,161, 2, 4, 8, 16) to eliminate redundant literals. It computes both Minimal Sum of Products (SOP) and Minimal Product of Sums (POS), supports Don’t Care conditions (XX), and provides full prime implicant grouping breakdowns for digital circuit optimization.

When to use it

  • Minimize combinational digital logic circuits to reduce physical gate count and propagation delay
  • Check homework and exam problems for Computer Architecture and Digital Systems coursework
  • Solve boolean minimization problems with Don’t Care states (dd)
  • Compare canonical Sum of Products (SOP) and Product of Sums (POS) implementations
  • Verify logic simplification proofs derived via boolean algebra theorems or De Morgan’s laws

How to use it

To solve a Karnaugh map

  1. Select the Number of variables:
    • 2 variables (A,BA, B): 4 cells (2×22 \times 2 grid).
    • 3 variables (A,B,CA, B, C): 8 cells (2×42 \times 4 grid).
    • 4 variables (A,B,C,DA, B, C, D): 16 cells (4×44 \times 4 grid).
  2. Enter values into the map using either of two methods:
    • Interactive grid: Click any cell to cycle through values: 0 →\rightarrow 1 →\rightarrow X (Don’t care) →\rightarrow 0.
    • Text input: Type comma-separated minterm numbers (Σm\Sigma m) and optional don’t cares (dd), then click Fill K-map from text.
  3. The solver computes the minimal boolean expressions in real time:
    • Minimal Sum of Products (SOP): Grouping of 1s and available Xs.
    • Minimal Product of Sums (POS): Grouping of 0s and available Xs.
  4. Review the Prime Implicant Groupings table below the expressions to see the binary cover and covered decimal minterms for each rectangular loop.
  5. Click Copy SOP or Copy POS to copy the simplified expression to your clipboard.

Questions

Why does a Karnaugh map use Gray code ordering?

Standard binary counting sequences (00,01,10,1100, 01, 10, 11) change two bits between 0101 and 1010. Karnaugh maps use Gray code sequences:

00→01→11→1000 \rightarrow 01 \rightarrow 11 \rightarrow 10

In Gray code, adjacent cells differ by exactly one bit (Hamming distance of 1). This ensures that any adjacent rectangular group of 2k2^k cells shares n−kn - k identical literal states, allowing the differing variable to be factored out via the boolean identity:

XY+XY′=X(Y+Y′)=X(1)=XXY + XY' = X(Y + Y') = X(1) = X

How are Don’t Care conditions (XX) utilized?

Don’t care conditions represent input combinations that can never occur in normal operation or whose output value does not affect system correctness (such as invalid BCD digits 1010 through 1515).

  • When grouping for Sum of Products (SOP), an XX is included in a loop of 1s if it helps form a larger rectangular power-of-two group (reducing literal count). Otherwise, it is ignored.
  • When grouping for Product of Sums (POS), an XX is similarly included if it expands a group of 0s.

What are Essential Prime Implicants?

  • A Prime Implicant is a maximal rectangular grouping of 1s (of size 1,2,4,8,…1, 2, 4, 8, \dots) that cannot be merged into any larger power-of-two group.
  • An Essential Prime Implicant is a prime implicant that covers at least one minterm mkm_k that is not covered by any other prime implicant. Essential prime implicants must be included in every minimal SOP solution.