Karnaugh Map Solver

Edit a truth table or Karnaugh map for two to four variables. Group 0s, 1s, and don't-cares to find and copy the minimal SOP or POS Boolean expression.

Variables
Expression form

Simplified expression

F = B'D' + BD
Groups

Highlighted rows 0, 2, 8, 10

Select an output to cycle through 0, 1, and X (don't care).

Karnaugh map

AB / CD00011110
00
01
11
10

Truth table

#ABCDOutput
00000
10001
20010
30011
40100
50101
60110
70111
81000
91001
101010
111011
121100
131101
141110
151111

Build a truth table and Karnaugh map

Choose two, three, or four variables. Select an output in either the truth table or the Karnaugh map to cycle through 0, 1, and X. The two views stay in sync. The small numbers in the map are row indices from the truth table, so cell 5 in the four-variable map corresponds to A B C D = 0 1 0 1.

Choose SOP or POS to see a minimal Boolean expression. Select a group to highlight its cells, and use Copy expression to take the result. Clear sets the current table to 0. Each variable count keeps its own table while you switch between them. Use Undo to recover the previous table after changing a value, clearing the table, or loading an example.

Try a group that wraps around the map

In the default four-variable example, the 1 cells are 0, 2, 5, 7, 8, 10, 13, 15. The row and column headers use Gray-code order 00, 01, 11, 10, so adjacent cells differ in one input bit. The left and right edges are adjacent, and so are the top and bottom edges.

The four corners share B = 0 and D = 0, giving the term B'D'. Cells 5, 7, 13, 15 share B = 1 and D = 1, giving BD. Together they simplify to B'D' + BD, which is true whenever B and D match.

What are SOP, POS, and don’t-care cells?

Sum of products (SOP) groups 1 cells. Each group gives an AND term, and OR joins the terms. Product of sums (POS) groups 0 cells. Each group gives an OR term, and AND joins the terms. An apostrophe marks negation, so B' means NOT B.

Set an output to X when either value is acceptable for that input combination. A group can use these cells if they let the expression use fewer terms or fewer variable occurrences. The solver first minimizes the number of terms, then the number of variable occurrences. Different expressions can tie for the same minimum.