Karnaugh Map Solver (K Map)
Click the cells of a 2, 3 or 4 variable Karnaugh map, or type minterms and don't cares, and get the minimal SOP and POS expressions with each group highlighted.
Tip: click a cell to cycle 0, 1 and X. The small number in each cell is its minterm index.
How to Solve a Karnaugh Map
A Karnaugh map is a truth table drawn as a grid. The rows and columns follow Gray code order (00, 01, 11, 10), so any two cells side by side differ in only one variable. That is why neighbouring 1s can be grouped and the changing variable drops out.
A group of 2k cells removes k variables
Edges wrap around: the left column touches the right column, the top row touches the bottom row
Grouping rules
- Group only 1s (and X cells when they help). Never include a 0.
- Make every group as large as possible: 8 beats 4, 4 beats 2.
- Groups must be rectangles whose size is a power of 2. Wrap around edges and corners is allowed.
- Use the fewest groups that cover every 1. Overlapping is fine.
- Don't care cells (X) can be used as 1 or left out, whichever gives a simpler answer.
Worked example
F(A, B, C, D) = Σm(0, 1, 2, 5, 6, 7, 8, 9, 10, 14). Cells 0, 1, 8 and 9 (the top and bottom rows wrap around) form the group B'C'. The whole CD = 10 column (2, 6, 14, 10) forms CD'. Cells 5 and 7 pair up as A'BD. Result: F = B'C' + CD' + A'BD, three terms instead of ten.
For the POS form the solver groups the 0 cells the same way and writes each group as a sum term, so you can check both answers and pick the cheaper circuit.
Frequently Asked Questions
What is a Karnaugh map used for?
A Karnaugh map (K map) simplifies a Boolean function to the fewest terms and literals, which means fewer logic gates or simpler PLC ladder rungs.
Why does the K map use 00, 01, 11, 10 order?
That is Gray code. Adjacent cells differ in one variable only, so grouping them removes that variable from the term.
What does a don't care (X) mean?
An input combination that never happens or whose output does not matter. The solver uses an X as 1 only when it makes a group bigger.
How do I get the POS form from a K map?
Group the 0 cells instead of the 1 cells, then write each group as a sum term with the variables complemented. This tool shows SOP and POS together.
Can a K map have more than 4 variables?
Yes, 5 and 6 variable maps use two or four 4 variable maps side by side, but they get hard to read. For more inputs use the Boolean algebra calculator.
Learn more on the blog
Karnaugh map explained with grouping rules
A practical guide on instrumentationblog.in that explains the theory behind this tool with solved examples.
Read Full Article