Skip to content
BetterDL

Karnaugh map

Also called: K-map, Kmap, K map, Karnaugh maps, K-maps, Karnaugh diagram

A grid version of a truth table, arranged in Gray code so that neighboring cells differ in one variable. Grouping its 1s gives a minimal SOP expression.

A Karnaugh map (K-map) is a truth table redrawn as a grid so that simplification becomes a visual search for rectangles.

Each cell is one input combination, one minterm. You write 1 in the cells where the function is 1. The trick is the ordering: rows and columns are labeled in gray code (00, 01, 11, 10), so any two cells that touch differ in exactly one variable.

Why that helps: two terms that differ in one variable combine, as in = . This is the combining rule. In a truth table such pairs can be far apart. On a K-map they sit side by side, and you can see them.

The method in brief:

  1. Fill the map with the function's 1s (and any don't-care X's).
  2. Circle groups: rectangles of 1, 2, 4, 8 or 16 cells containing only 1s and X's. Edges wrap around.
  3. Choose the fewest, largest groups that cover every 1, starting with the essential prime implicants.
  4. Read each group as one product term and OR them together.

The result is a minimal sum of products. Grouping the 0s instead gives a minimal product of sums.

K-maps work best for 2 to 4 variables. Five or six variables need stacked maps, and beyond that, software takes over using the same ideas.

A\BC00011110
0
0m0
0m1
1m3
0m2
1
1m4
1m5
1m7
0m6

Worked examples

Example

A 3-variable map, start to finish

Simplify F = Σm(3, 4, 5, 7), the map shown above.

  1. 1.

    Place each minterm with its binary code (A picks the row, BC the column): m3 = 011, m4 = 100, m5 = 101, m7 = 111.

  2. 2.

    m3 has one neighboring 1, m7, directly below. Group them: B = 1 and C = 1 stay fixed, A changes → .

  3. 3.

    m4 has one neighboring 1, m5, to its right. Group them: A = 1 and B = 0 stay fixed, C changes → .

  4. 4.

    Every 1 is covered. The pair m5 m7 is also valid but adds nothing. F = , two terms instead of four minterms.

Example

A 4-variable map

Simplify F = Σm(0, 1, 2, 3, 5, 7, 13, 15).

AB\CD00011110
00
1m0
1m1
1m3
1m2
01
0m4
1m5
1m7
0m6
11
0m12
1m13
1m15
0m14
10
0m8
0m9
0m11
0m10
  1. 1.

    Row AB = 00 is all 1s: m0, m1, m3, m2. That row is the group .

  2. 2.

    m5, m7, m13, m15 form a 2×2 square in rows 01 and 11, columns 01 and 11. B = 1 and D = 1 stay fixed → .

  3. 3.

    Every 1 is now covered. The group m1, m3, m5, m7 () is also valid, but it adds nothing new.

  4. 4.

    F = .

Common mistakes

  • Labeling an axis 00, 01, 10, 11. That's binary order, and it puts cells that differ in two bits side by side.

  • Finding a cell by counting along the grid. Write the minterm in binary and read off its row and column labels instead.

  • Forgetting that the map wraps. The left and right edges touch, and so do the top and bottom.

Practice Karnaugh map

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Karnaugh map is taught in Karnaugh Maps and Boolean Simplification.