Home / Learn Chip Programming / Karnaugh Maps Step by Step

Karnaugh Maps Step by Step

A K-map is a picture of a truth table that makes simplification visual.

In shortA K-map is a picture of a truth table that makes simplification visual.

Theory in plain words

K-map rulesGroups must be 1, 2, 4, 8 or 16 cells (powers of two)Groups are rectangles and can wrap around the edgesUse as few, as large groups as possible; every 1 must be coveredDon't-care cells (X) may be used to make a group bigger
K-map rules

What it is

Cells are ordered in Gray code so neighbours differ by one input. Circle groups of 1, 2, 4 or 8 ones; each group drops the variables that change.

Why we use it

It is the fastest hand method to simplify logic of up to 4 inputs. It also builds the intuition that synthesis tools use.

How it works

Fill 1s from the truth table. Make the biggest possible groups (powers of two, rectangles, wrapping around edges). Each group gives one product term; OR the terms.

Where it is used

  • Designing small controllers and decoders
  • Exam questions and interviews
  • Understanding how tools optimise logic

3 variable K-map minimiser

Click cells to set the truth tableTry it Yourself

Try 1s at 3, 7 (BC = 11): the result is B C. Try the whole row A = 1: result is A. Groups of two cells drop one variable, groups of four drop two.

Worked example

Truth table 1s at ABC = 011, 111, 101, 110. On the K-map the cells 011 and 111 form a group (BC), 101 and 111 form a group (AC), 110 and 111 form a group (AB). Result: Y = AB + AC + BC, the "majority" function (output is 1 if at least two inputs are 1).

Tip:Don't-care states (inputs that can never happen, like BCD values 10 to 15) are marked X. Treat them as 1 when they enlarge a group and ignore them otherwise.

Quick quiz

1. How are K-map columns ordered?

2. A group of 4 ones removes how many variables?

Common questions

How are K-map columns ordered?

Gray code order. Gray order makes neighbours differ by one input.

A group of 4 ones removes how many variables?

2. Group size 2^k removes k variables.