SOP / POS Builder & K-Map Solver
Two views of the same Boolean function. Click a row in the truth table or a cell on the K-map — both update instantly. The truth table reads off the canonical Σm / ΠM form; the K-map reads off the minimum SOP / POS via prime-implicant grouping.
Click a row or cell to cycle 0 → 1 → X (don’t-care).
SOP / POS Form Builder
Truth-table view — reads off the canonical Σm and ΠM expressions (every row gets its own product / sum term).
| # | A | B | C | F |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | |
| 1 | 0 | 0 | 1 | |
| 2 | 0 | 1 | 0 | |
| 3 | 0 | 1 | 1 | |
| 4 | 1 | 0 | 0 | |
| 5 | 1 | 0 | 1 | |
| 6 | 1 | 1 | 0 | |
| 7 | 1 | 1 | 1 |
SOP (sum-of-products) lists the rows where F=1; POS (product-of-sums) lists the rows where F=0. Don't-cares appear in d(...) / D(...) and are absorbed by the minimiser of your choice.
K-Map Solver
Karnaugh-map view — reads off the minimum SOP via prime-implicant grouping. Coloured rectangles cover the 1-cells; each rectangle is one product term.
K-map minimisation
A Karnaugh map (K-map) arranges truth table outputs in a grid so that logically adjacent cells differ by exactly one variable. Grouping adjacent 1s visually cancels variables and produces a minimal Sum of Products (SOP) expression; grouping 0s gives a minimal Product of Sums (POS).
Grouping rules
- Groups must contain 1, 2, 4, 8, … cells (powers of 2 only).
- Groups wrap around edges — the map is a torus, not a flat grid.
- Always use the largest possible groups; overlapping is fine.
- Don't-care (×) cells can be included in any group to maximise its size.
SOP vs POS
SOP groups the 1s (minterms) → AND terms ORed together → NAND-NAND implementation. POS groups the 0s (maxterms) → OR terms ANDed together → NOR-NOR implementation. Choose whichever produces fewer terms.
Learn more → Karnaugh Maps — Learn
Quick experiments
- Halve the term count with one group. Mark two horizontally adjacent 1s. Because only one variable differs between them, it drops out and two three-variable products collapse into a single two-variable one.
- Group across the edges. Put 1s in the far-left and far-right cells of a row. They are logically adjacent even though they look apart — the map wraps like a cylinder, so they form a valid pair.
- Find the four corners. Set 1s in all four corners of a 4-variable map. They wrap both horizontally and vertically and form one group of four, cutting the expression down to two literals.
- Read POS by grouping the zeros. Switch to grouping 0s. The same map now yields the Product of Sums form. Compare the gate count against SOP — whichever has fewer marks usually wins.
- Watch overlapping groups pay off. Overlap two groups over a shared 1. Reusing a cell is allowed and usually makes both groups bigger, which removes more variables than splitting them would.
Formula reference
- Variables eliminated by a group
A group of 2 removes 1 variable, 4 removes 2, 8 removes 3.
- Literals left in a term
On a 4-variable map, a group of 4 leaves 4 − 2 = 2 literals.
- Canonical SOP (sum of minterms)
Each minterm is one cell holding a 1.
- Canonical POS (product of maxterms)
Maxterm indices are exactly the cells holding 0.
| Symbol | Meaning | Unit |
|---|---|---|
| Number of input variables | — | |
| Minterm — one row where the output is 1 | — | |
| Maxterm — one row where the output is 0 | — |
Common mistakes
Labelling the map in plain binary order.
Columns and rows run 00, 01, 11, 10 — Gray code, not 00, 01, 10, 11. With binary labelling, neighbouring cells differ by two variables and every grouping is invalid.
Making groups of three cells.
Group sizes must be powers of two: 1, 2, 4, 8, 16. Three 1s in a row are covered as a group of two plus an overlapping group of two, never as a group of three.
Refusing to overlap groups.
Cells may belong to several groups. Overlapping usually allows larger groups, and larger groups mean fewer literals in the final expression.
Missing the wrap-around adjacencies.
Left and right edges are adjacent, and so are top and bottom. The four corners of a 4-variable map form one legal group of four.
Grouping 1s and then writing the POS form.
Grouping 1s yields SOP. For POS you group the 0s and complement each variable as you read the sum terms — mixing the two produces an expression that is simply wrong.
Frequently asked questions
What is a Karnaugh map used for?
A Karnaugh map is a grid arrangement of a truth table that places logically adjacent terms next to each other. Grouping adjacent 1s lets you spot and cancel redundant variables visually, which is usually faster and less error-prone than algebraic simplification for up to four or five variables.
What are the rules for grouping in a K-map?
Groups must be rectangular and contain a power-of-two number of cells: 1, 2, 4, 8 and so on. Make every group as large as possible, allow groups to overlap, wrap around the edges of the map, and keep going until every 1 is covered by at least one group.
Why is the K-map ordered in Gray code rather than binary?
Gray code ordering means only one variable changes between neighbouring cells. That is what makes physical adjacency equal logical adjacency, so a group of two cells always eliminates exactly one variable.
How do I read a POS expression off a K-map?
Group the 0s instead of the 1s. Each group becomes a sum term, and within it every variable is complemented relative to how you would write the product term. Combining those sum terms with AND gives the Product of Sums form.
Related tools
Quine–McCluskey Reducer
Tabular minimisation — iteration columns, PI chart, and minimum SOP.
Open →Universal Gate Builder
Build NOT / AND / OR / XOR / XNOR from NAND-only or NOR-only gates.
Open →Adder & Subtractor
Half / full adder up to 4-bit signed add-subtract with overflow flag.
Open →Combinational Blocks
4:1 MUX, 2-to-4 decoder, and 4-bit comparator — toggle between blocks.
Open →Static Hazard Analyzer
Watch a static-1 glitch on F = AB + A'C — add the consensus cover to kill it.
Open →Flip-Flop Simulator
D, JK, T, SR, SR active-low — toggle inputs, watch waveforms, see excitation tables.
Open →Browse the full circuit toolkit or start a guided lesson in topics.