Skip to content
K-Map Solver

4-Variable Karnaugh Map Solver

Sixteen cells, the classic exam size. Click the map or type minterms and see the minimal expression with wrap-around groups drawn properly.

Try an example
Variables
ABCD0001111000011110

F = Σm(0, 2, 7, 10, 14) + d(5, 8)

5 ones · 2 don't-cares · 9 zeros

0false1trueXdon't care (either)

Click a cell to cycle 0 → 1 → X, or hold the button and drag to paint. With the keyboard: arrow keys move, 0 1 X set a value, Space cycles, Page Up/Down switches layers, Ctrl+Z undoes.

Variable namesA B C D

1–3 characters, starting with a letter. Names must be different from each other.

Simplified K-map result

Updates as you edit. Hover a term or a card to see its group on the map.

ABCD0001111000011110

Simplified Boolean expression

F =B'D'+A'BD+ACD'

3 terms8 literals7 gates Checked against your function

Groups

  • B'D'Essential
    Minterms
    (0, 2, 8, 10)
    Uses don't-care 8
    Original
    A'B'C'D' + A'B'CD' + AB'C'D' + AB'CD'
    Simplified
    B'D'
  • A'BDEssential
    Minterms
    (5, 7)
    Uses don't-care 5
    Original
    A'BC'D + A'BCD
    Simplified
    A'BD
  • ACD'Essential
    Minterms
    (10, 14)
    Original
    AB'CD' + ABCD'
    Simplified
    ACD'

Truth table check

14 match2 don't-care0 mismatch

Every input row is evaluated against the simplified expression. A don't-care (X) row may give 0 or 1.

mABCDYour FResultStatus
0000011 Match
1000100 Match
2001011 Match
3001100 Match
4010000 Match
50101X1 Either (X)
6011000 Match
7011111 Match
81000X1 Either (X)
9100100 Match
10101011 Match
11101100 Match
12110000 Match
13110100 Match
14111011 Match
15111100 Match
Step-by-step: how the solver gets there (Quine–McCluskey)

Logic circuit

Fit
ABCDF
3 AND gates, 1 OR gate and 3 inverters14 gate inputs3 levels Simulated circuit matches your function

Hover a gate to highlight its group · drag to pan · Ctrl/⌘ + scroll or the buttons to zoom.

Gate list
  • A' = NOT(A)
  • B' = NOT(B)
  • D' = NOT(D)
  • G1 = AND(B', D')
  • G2 = AND(A', B, D)
  • G3 = AND(A, C, D')
  • F = OR(G1, G2, G3)

Export & share

Files always use the light theme so they print cleanly.

Images
Expression as
F = \overline{B} \overline{D} + \overline{A} B D + A C \overline{D}

Rows, columns and wrap-around

Rows are AB and columns are CD, both in the order 00, 01, 11, 10. Because the map wraps both ways, the four corners are neighbours and so are the top and bottom rows.

Valid groups have 1, 2, 4, 8 or 16 cells and are rectangles on this wrapped surface. The four corners (cells 0, 2, 8 and 10) form a group of four that is easy to miss.

Using don't-cares well

Treat an X as a 1 only if it lets a group grow. Never add a group just to cover an X. The example below uses one don't-care to complete the corners and another to pair up with cell 7.

Worked example: sum of products

Ones at 0, 2, 7, 10 and 14, with don't-cares at 5 and 8.

F = Σm(0, 2, 7, 10, 14) + d(5, 8)

ABCD0001111000011110

Simplified result

F = B'D' + A'BD + ACD'

  • B'D' — minterms (0, 2, 8, 10), includes don't-care 8
  • A'BD — minterms (5, 7), includes don't-care 5
  • ACD' — minterms (10, 14)

Worked example: sum of products

Segment a of a BCD-to-seven-segment decoder: six input codes never occur, so they are don't-cares.

F = Σm(0, 2, 3, 5, 6, 7, 8, 9) + d(10, 11, 12, 13, 14, 15)

ABCD0001111000011110

Simplified result

F = B'D' + C + BD + A

  • B'D' — minterms (0, 2, 8, 10), includes don't-care 10
  • C — minterms (2, 3, 6, 7, 10, 11, 14, 15), includes don't-care 10, 11, 14, 15
  • BD — minterms (5, 7, 13, 15), includes don't-care 13, 15
  • A — minterms (8, 9, 10, 11, 12, 13, 14, 15), includes don't-care 10, 11, 12, 13, 14, 15

How to use the K-map solver

  1. Pick the number of variablesChoose 2 to 6. Five and six variables are drawn as several 4×4 layers whose matching cells are neighbours.
  2. Describe your functionClick cells on the map, fill in a truth table, type a Boolean expression, or list minterms or maxterms. All five views edit the same function.
  3. Mark don't-caresCycle a cell 0 → 1 → X. A don't-care may be treated as 0 or 1, whichever makes the groups bigger.
  4. Choose SOP or POSSum of products groups the ones. Product of sums groups the zeros and gives the maxterm form.
  5. Read the groupsEach coloured outline is one term. The same colour marks the term in the expression and its card, which lists the cells it covers.
  6. Check, build, exportCompare the result with your input in the verification table, open the logic circuit, step through the algorithm, then export or share.

Key features

  • 2 to 6 variables

    Up to 64 cells, with layered maps for 5 and 6 variables.

  • Five ways to enter a function

    Map, truth table, expression, minterm list or maxterm list — switch freely.

  • Provably minimal

    Exact cover search over all prime implicants, with every equally good alternative on offer.

  • Don't-care aware

    X cells enlarge groups but never have to be covered.

  • Wrap-around groups

    Groups across the map edges are drawn as open brackets, the way textbooks show them.

  • Logic circuit

    AND–OR, OR–AND, NAND-only or NOR-only schematics with zoom and gate counts.

  • Self-checking

    Every answer is re-evaluated against your input; a truth table flags any mismatch.

  • Step-by-step

    Quine–McCluskey tables, the prime-implicant chart and Petrick's method.

  • Export and share

    PDF report, PNG/SVG, LaTeX, Verilog, VHDL, C, and a link that reopens your problem.

  • Private and offline-friendly

    Everything runs in your browser. Nothing you enter is uploaded.

Frequently asked questions

Which cells are the four corners?

Minterms 0, 2, 8 and 10 (A'B'C'D', A'B'CD', AB'C'D' and AB'CD'). They differ pairwise in one variable across the wrapped edges, so they form a group of four: B'D'.

What if two solutions are equally good?

The result panel lists every alternative with the same number of terms and literals, so you can pick the one that suits your circuit.