Skip to content
K-Map Solver

5-Variable Karnaugh Map Solver

Five variables need 32 cells. The solver shows two 4×4 maps, A = 0 and A = 1, and links the groups that continue from one into the other.

Try an example
Variables

Scroll sideways to see all layers.

A = 0BCDE0001111000011110A = 1BCDE0001111000011110

F = Σm(2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)

11 ones · 0 don't-cares · 21 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 E

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.

A = 0BCDE0001111000011110A = 1BCDE0001111000011110

Simplified Boolean expression

F =A'B'C'D+B'DE+A'C'DE+A'CD'E+AB'C'E+ABCE

6 terms23 literals11 gates Checked against your function

Groups

  • A'B'C'DEssential
    Minterms
    (2, 3)
    Original
    A'B'C'DE' + A'B'C'DE
    Simplified
    A'B'C'D
  • B'DEChosen
    Minterms
    (3, 7, 19, 23)
    Original
    A'B'C'DE + A'B'CDE + AB'C'DE + AB'CDE
    Simplified
    B'DE
  • A'C'DEEssential
    Minterms
    (3, 11)
    Original
    A'B'C'DE + A'BC'DE
    Simplified
    A'C'DE
  • A'CD'EChosen
    Minterms
    (5, 13)
    Original
    A'B'CD'E + A'BCD'E
    Simplified
    A'CD'E
  • AB'C'EEssential
    Minterms
    (17, 19)
    Original
    AB'C'D'E + AB'C'DE
    Simplified
    AB'C'E
  • ABCEChosen
    Minterms
    (29, 31)
    Original
    ABCD'E + ABCDE
    Simplified
    ABCE

Truth table check

32 match0 mismatch

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

mABCDEYour FResultStatus
00000000 Match
10000100 Match
20001011 Match
30001111 Match
40010000 Match
50010111 Match
60011000 Match
70011111 Match
80100000 Match
90100100 Match
100101000 Match
110101111 Match
120110000 Match
130110111 Match
140111000 Match
150111100 Match
161000000 Match
171000111 Match
181001000 Match
191001111 Match
201010000 Match
211010100 Match
221011000 Match
231011111 Match
241100000 Match
251100100 Match
261101000 Match
271101100 Match
281110000 Match
291110111 Match
301111000 Match
311111111 Match
Step-by-step: how the solver gets there (Quine–McCluskey)

Logic circuit

Fit
ABCDEF
6 AND gates, 1 OR gate and 4 inverters33 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)
  • C' = NOT(C)
  • D' = NOT(D)
  • G1 = AND(A', B', C', D)
  • G2 = AND(B', D, E)
  • G3 = AND(A', C', D, E)
  • G4 = AND(A', C, D', E)
  • G5 = AND(A, B', C', E)
  • G6 = AND(A, B, C, E)
  • F = OR(G1, G2, G3, G4, G5, G6)

Export & share

Files always use the light theme so they print cleanly.

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

Why two maps?

A single flat grid cannot keep every neighbour exactly one bit apart once there are five variables. Stacking two four-variable maps solves it: layer A = 0 and layer A = 1.

Two cells are neighbours when they are adjacent inside a layer (with wrap-around) or when they sit in the same position on both layers — those differ only in A.

Groups across layers

A group that exists on both layers needs the same footprint on each, and its term does not contain A. The solver connects such pieces with a dotted line, so you can see which two outlines are one group.

Worked example: sum of products

A prime-number detector for the inputs 0 to 31, written A (most significant) to E.

F = Σm(2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)

A = 0BCDE0001111000011110A = 1BCDE0001111000011110

Simplified result

F = A'B'C'D + B'DE + A'C'DE + A'CD'E + AB'C'E + ABCE

  • A'B'C'D — minterms (2, 3)
  • B'DE — minterms (3, 7, 19, 23)
  • A'C'DE — minterms (3, 11)
  • A'CD'E — minterms (5, 13)
  • AB'C'E — minterms (17, 19)
  • ABCE — minterms (29, 31)

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

How are minterms numbered with five variables?

A is the most significant bit. Minterm 19 is 10011, that is AB'C'DE. Cells 0–15 are on the A = 0 layer and 16–31 on the A = 1 layer.

Do I have to pair up the layers myself?

No. The solver finds all prime implicants, including those that span layers, and draws them for you.