1. Build the truth values
The expression parser evaluates all 2n assignments, or the entered minterms directly mark the 1 cells. Don't-cares replace either value with X.
Use the selected variables only. Adjacency means AND, so A'B means ¬A ∧ B.
Enter comma- or space-separated indices; ranges such as 4-7 work. Leave blank for the constant 0 function.
These cells appear as X and may be used only when they simplify a group.
Private by design: your expression and cell choices stay on this device. They are not uploaded, saved, or added to the page URL.
Your interactive Karnaugh map will appear here.
Select Build and simplify or press Ctrl/⌘ + Enter.
| Operation | Accepted input | Example |
|---|---|---|
| NOT | !A, ~A, ¬A, A', not A | A'B |
| AND | Adjacency, &, *, ·, ∧, and | AB |
| OR | +, |, ∨, or | A + B |
| XOR | ^, ⊕, xor | A xor B |
| Grouping | ( ) | A(B + C) |
Operator precedence is NOT, AND, XOR, then OR. Constants 0 and 1 are accepted. For minterms, A is the most significant bit: with four variables, index 10 is A B C D = 1 0 1 0. Both 9-12 and 9–12 are valid ranges.
The expression parser evaluates all 2n assignments, or the entered minterms directly mark the 1 cells. Don't-cares replace either value with X.
Rows and columns use 0, 1 or 00, 01, 11, 10 order. Adjacent cells—including cells across opposite edges—differ in exactly one bit.
The tool considers every rectangular implicant represented by a fixed/don't-care bit pattern. A valid SOP group covers 1s and optional Xs but no 0s; POS reverses 1 and 0.
Prime implicants are compared exhaustively. The chosen cover minimizes the number of terms first, then the total number of literals, with deterministic tie-breaking.
Grouping rules: groups contain a power-of-two number of cells, may overlap, and may wrap around map edges. Every required 1 must be covered for SOP, while every required 0 must be covered for POS. X cells are optional and are used only if helpful. These conventions follow the University of Maryland K-map grouping rules and Sonoma State University’s explanation of Gray-code adjacency and don't-cares.
Scope: K-maps are clearest for small functions, so this page intentionally supports 2–4 variables. It returns minimum two-level SOP and POS covers. It does not optimize a factored, XOR-heavy, NAND-only, or technology-specific physical circuit, and another equally minimal cover may exist.
Editorial review: Gray-code placement, minterm indexing, implicant rules, don't-care handling, and representative SOP/POS results checked by the Starlight Tools editorial team. Last reviewed: .
For F(A,B,C) = Σm(4,5,6,7), all four cells have A = 1 while B and C vary. One four-cell group therefore simplifies to F = A.
In Gray-code order, columns 00 and 10 sit at opposite ends but differ in one bit. A group can wrap from the left edge to the right edge; the border is not a logical break.
For F(A,B,C) = Σm(1,3,7), d(5), the X at 5 completes a four-cell group across all rows where C = 1. The minimal result is F = C. Without that don't-care, more literals are required.
SOP groups 1 cells to produce product terms joined by OR. POS groups 0 cells to produce sum factors joined by AND. Either form represents the same specified function.
A Karnaugh map, or K-map, rearranges a truth table into a Gray-code grid. Because adjacent cells differ in one variable, grouping adjacent 1s or 0s shows which variables can be removed from a Boolean term.
Use A, B, C, and D with familiar logic symbols. NOT may be !, ~, ¬, or a trailing apostrophe; adjacency means AND; + means OR; and ^ means XOR. Parentheses override precedence.
It is the decimal value of an input assignment read as binary, with A as the most significant bit. In a four-variable map, minterm 10 is binary 1010, so A = 1, B = 0, C = 1, and D = 0.
Enter an X only for an input combination whose output genuinely does not matter. The simplifier can include that X in an SOP or POS group if it creates a smaller expression, but it does not have to cover it.
Yes. Opposite edges are adjacent, so groups can wrap horizontally, vertically, or around all four corners. Groups may overlap when that is required for a minimum cover.
They use Gray-code order: 00, 01, 11, 10. Each neighboring pair differs in one bit, including the first and last labels, which preserves K-map adjacency.
Within the supported 2–4 variables, the tool selects an exact two-level cover with the fewest terms and then the fewest literals. Different expressions can tie at that score, and a technology-specific circuit may benefit from factoring or XOR gates.
No. The parser, exact-cover calculation, interactive cell changes, copying, and CSV export all operate locally in the browser.