Karnaugh Map
Karnaugh map with a minimal DNF and selectable groups, including wraparound groups.
About this tool
Enter a Boolean expression or choose Minterms and specify 2–4 variables. Calculate builds a compact Karnaugh map and a complete minimal DNF. Copy takes the complete formula. Example loads the wrapped four corners 0,2,8,10 with four variables; its result is ¬b ∧ ¬d. Default restores a & b and clears the result. Empty minterms means the constant false function.
The top-left header names row and column variables. Gray order is 0,1 or 00,01,11,10; the first and last rows/columns are neighbours. Click 1-cells or focus them with Tab and press Enter/Space to select a group. A valid group is a rectangular power-of-two set containing only ones, including wrapped edges/corners. Clear group removes the selection. Invalid selections show a message, not a guessed term. Open Cover groups and click a term to highlight the corresponding cells. Overlapping groups are allowed.
Expression syntax: !/¬ NOT, &/∧ AND, ^/⊕ XOR, |/∨ OR, ->/→ implication, <->/↔ equivalence, parentheses, 0/1 and operator keywords. Precedence follows this order; implication is right-associative. ASCII variable names are case-insensitive, keywords reserved. Variables are alphabetically ordered and the first is the most significant minterm bit. Constant or one-variable expressions are padded to the smallest two-variable map with unused a/b variables; this does not change the function.
All valid rectangles are enumerated; maximal groups (prime implicants) form an exact minimum cover. The result has the fewest AND-terms, then the fewest literals among tied covers. Equally minimal alternatives may exist; this shows one. No don't-cares, POS/CNF minimization or hazard-free circuit guarantee. At most four variables/16cells, 4096 characters/256tokens; minterms are decimal whole indices with whitespace, comma or semicolon separators, no hex/fractions/signs. Duplicate indices are harmless. Bounds precede recursive parsing. Everything runs locally without saving input in cookies/URLs; the clipboard remains until replaced.