Skip to content
KmapGen

K-Map Grouping Rules

Updated 2026-11-22 · 6 min read

Eight rules decide which circles you may draw on a Karnaugh map and which ones you should. The first four make a group legal; the last four make the answer minimal.

1. Group only 1s (or only 0s)

For a sum of products, every cell in a group must be a 1 or a don’t-care (X). For a product of sums, group the 0s and Xs instead. A group may never contain a cell of the other value.

2. The size is a power of two

1, 2, 4, 8, 16, 32 or 64 cells. Each doubling lets exactly one more variable change inside the group, and that variable disappears from the term.

Group sizeVariables removedLiterals left with 4 variables
104
213
422
831
1640 (F = 1)

3. Groups are rectangles

Rows, columns, squares and 2×4 blocks are fine. L shapes, zigzags and diagonals are not: their cells do not share a fixed set of variable values.

4. Edges wrap around

The leftmost and rightmost columns are adjacent, and so are the top and bottom rows. In a 4×4 map the four corners form a group. In 5- and 6-variable maps, cells in the same position on adjacent maps are adjacent too.

The four corners of a 4-variable K-map grouped as B'D'ABCD000111100001111010010312040507060120130150141809011110
The four corners are one group: B = 0 and D = 0 in all four, so the term is B′D′.
A group of four wrapping across the left and right edgesABCD000111100001111000010302140507161120130151140809011010
m4, m6, m12 and m14 wrap across the left and right edges: B = 1 and D = 0, so the term is BD′.

Rules for a minimal answer

5. Make every group as large as possible

A group that could be doubled while staying legal leaves an unnecessary literal in its term. Groups that cannot be enlarged are called prime implicants; a minimal answer uses only those.

6. Use as few groups as possible

Each group is one term (one gate in the circuit). Start with 1s that can be covered in only one way: their groups are essential and belong to every minimal answer.

7. Overlap freely

A 1 may sit in two or more groups if that makes the groups larger.

Solved 4-variable K-map for Σm(1, 3, 5, 7, 13, 15)ABCD000111100001111000111302041517060121131150140809011010
F = Σm(1, 3, 5, 7, 13, 15) → F = A'D + BD
  1. A'D: group of 4 (m1, m3, m5, m7), essential. A = 0, D = 1 in every cell; B, C change inside the group and drop out.
  2. BD: group of 4 (m5, m7, m13, m15), essential. B = 1, D = 1 in every cell; A, C change inside the group and drop out.

Result: F = A'D + BD, 2 terms and 4 literals. Open this example in the solver.

8. Never add a redundant group

If every 1 in a group is already covered by other groups, drop it. The classic trap is the “middle” group in a chain: in AB + A′C + BC, the group BC only covers cells that AB and A′C already cover (the consensus theorem).

Don’t-cares

An X may be included in a group when that makes the group larger, and left out otherwise. Never draw a group just to cover Xs. See don’t-care conditions for a full example.

Check your groups with the K-map solver: it draws the prime implicants it chose, marks the essential ones and lists every equally minimal alternative.

Frequently asked questions

Can you group 3 cells in a K-map?

No. A group must contain a power of two cells (1, 2, 4, 8…), because each doubling removes exactly one variable. Three 1s in a row are covered by two overlapping pairs.

Can K-map groups overlap?

Yes. A 1 may belong to several groups, and overlapping is often what makes each group as large as possible. What you must avoid is a group whose cells are all already covered by other groups.

Can you group diagonally in a K-map?

No. Diagonal cells differ in two variables, so they cannot merge into one shorter term. A′B′ + AB (the XNOR) has its 1s on a diagonal and does not simplify.

Are the corners of a 4-variable K-map adjacent?

Yes: m0, m2, m8 and m10 all have B = 0 and D = 0, and the map wraps around horizontally and vertically, so the four corners form one group of four, B′D′.