gizmobench

Minesweeper Solver

Type in a Minesweeper board as it stands, or paste it as text, and see which cells are certain and, given the mine total, the exact chance of a mine everywhere else. Certain moves come with the sentence that decided them, your flags are checked against the numbers, and a board that cannot happen is called a contradiction instead of answered. Chances are counted, not estimated: every layout that fits the numbers is counted and weighted by the mine total, and a count that reaches its step limit shows no chance rather than a guess.

boardexample, 9 x 9, 10 mines, 1 flag
1
1
2
1
1
1
1
1
1
2
1

safe for certain · mine for certain · your flag · small numbers are the chance of a mine in percent, rounded

A1: unopened

analysisworking

Board size
and

Mines is the game’s mine count. Total means every mine on the board, flagged or not; Left on counter means the number the game shows after your flags, and your 1 flag is added back. Leave it empty for certain moves only.

Safe for certain
none
Mine for certain
none
Lowest mine chance
counting
Layouts counted
counting

The board is a keyboard: arrow keys move, 1 to 8 open the cell showing that number, 0 or a full stop open it as a blank, F puts a flag on or takes it off, and Backspace or # makes the cell unopened again. With a mouse, right-click flags. On a phone, tap a cell and use the buttons under the board. Paste a board anywhere on the grid to fill it from text. Boards run from 2 to 50 cells a side. The board stays in this browser, and the page’s Start over button forgets it.

Board as text

One row per line: # unopened, F flag, a full stop or 0 for an opened blank, 1 to 8 for numbers. Spaces between cells are ignored.

Three boards and what comes back

  • A revealed 1 with one unopened neighborno flags around it
    A1 is a forced mine: B1 = 1 needs 1 mine and only A1 is left
  • Flags that break a numbera 1 with two flags beside it
    contradiction: B1 shows 1 but has 2 flags beside it, so no move or chance is shown
  • Two unopened cells sharing one minesymmetric, nothing else touches them
    C1, C2: 50% each, never called safe
Certain, then counted. Rules settle what they can first, each with the sentence that settled it. The unopened cells that touch a number are then split into groups no number links, and every placement of mines in each group that fits its numbers is listed. With a total, each placement is weighted by the number of ways to put the remaining mines in the cells no number touches, so every full-board layout counts once.
Accuracy. Certain moves are exact deductions from the numbers you enter, with your flags counted as mines, and a board whose numbers and flags cannot all be true is reported as a contradiction. Chances count every mine layout that fits, weighted by the mine total you give, so they are only as right as the board and total you typed; without a total it shows certain moves only, and past its counting limit it shows no chance rather than an estimate. Anything short of certain is shown as a chance and never called safe, and the tool does not read your screen or play a game for you. Nothing is uploaded: the count runs in this tab and the board stays in this browser.

Common questions

How does this Minesweeper solver work?
It applies rules first: a number whose mines are all found clears its other neighbors, a number needing as many mines as it has unopened neighbors marks them all, and where one number's unopened cells sit inside another's, the difference is decided the same way. Each of those moves is listed with the sentence that decided it. Then it splits the unopened cells that touch a number into groups no number links and lists every placement of mines in each group that fits its numbers. A cell that is clear in every placement, or mined in every one, is certain.
Why does it need the total number of mines?
Without a total it gives certain moves only. With one, a placement that puts fewer mines beside the numbers leaves more for the rest of the board, and there are more ways to spread them, so placements are weighted by the number of ways to put the remaining mines in the cells no number touches. That makes every full-board layout that fits count once and equally. If you read the number off the game's counter after flagging, choose Left on counter and your flags are added back.
Is a 50/50 guess really 50/50?
When two unopened cells share one mine and nothing else on the board tells them apart, the count gives each exactly one half, and the analysis prints 50%. In the analysis and the readout, a whole percent is printed only when the fraction is exactly that; anything else is the exact fraction rounded to one decimal place, and selecting a cell shows the fraction itself when it is short enough to read. The small numbers on the board are rounded to whole percents to fit the cells, and a chance under 1% shows as <1, never 0. A chance is never called safe, however small it is.
What does contradiction mean?
The numbers and flags you entered cannot all be true at once, for example a 1 with two flags beside it, or a number with fewer unopened cells around it than mines to place. The tool says which number, numbers or flags break, marks them on the board, and shows no move or chance, because any answer to an impossible board would be made up. A mine total the board cannot hold is also reported as a contradiction, with the fewest or most mines the board allows when that is what rules the total out.
Why did it stop counting at a limit?
Some boards have more placements than it is sensible to list, so the count stops at 50,000,000 search steps. When it does, it keeps the certain moves from the rules and from any group it finished, and shows no chance at all rather than one from a partial count. Keep counting gives it another 50,000,000 steps, and while it counts you can cancel and resume.
Does it read my screen or play the game for me?
No. You type or paste the board yourself, and the analysis runs in this browser tab with nothing uploaded. It does not open cells in a game or control one. The board you entered is kept in this browser so it is there next time, and the page's Start over button forgets it.
How large a board can I enter?
Any board from 2 to 50 cells a side. The Beginner, Intermediate and Expert buttons set the classic 9 by 9 with 10 mines, 16 by 16 with 40 and 30 by 16 with 99, keeping whatever part of your board still fits.

Certain moves are exact deductions from the numbers you enter, with your flags counted as mines, and a board whose numbers and flags cannot all be true is reported as a contradiction. Chances count every mine layout that fits, weighted by the mine total you give, so they are only as right as the board and total you typed; without a total it shows certain moves only, and past its counting limit it shows no chance rather than an estimate. Anything short of certain is shown as a chance and never called safe, and the tool does not read your screen or play a game for you.