Minesweeper solver

Copy your board into the minesweeper solver and it marks every cell that is certainly safe, every certain mine, and the exact chance of a mine in each other hidden cell, with the reason for each certain cell.

Tap a cell to set it to

Pick a value above, then tap cells. Tap the same value again to hide a cell.

Solver

How to use the minesweeper solver

Pick the board size: beginner (9 x 9, 10 mines), intermediate (16 x 16, 40 mines), expert (16 x 30, 99 mines) or custom. Then copy your game into the minesweeper solver: choose a number from the palette and tap the cells that show it, tap the flag and mark the mines you have flagged, and leave everything else hidden. You can also click a cell and type its number on a keyboard (f for a flag, h for hidden, arrow keys to move). Keep the total number of mines right: it changes the odds.

The solver updates after every change. A check mark means the cell is safe in every possible layout, a dark star means it is a mine in every layout, and the other hidden cells show their chance of holding a mine, in percent. The ringed cell is the suggested next click. Under Why these cells are certain each deduction is explained in words; tap one to see its cells on the board.

How the solver works

It does not use a list of patterns. It counts. Every hidden cell next to a number belongs to the border. The solver splits the border into groups that do not share a number, and for each group it lists every way of placing mines that agrees with all the numbers and flags, keeping count of how many mines each way uses. The cells away from the numbers get whatever mines are left, and the number of ways to spread them follows from simple counting (combinations). Combining the groups with those counts gives each layout its correct weight, and the chance of a mine in a cell is the weighted share of layouts in which it holds one.

That is why it can see things simple rules miss, such as a cell that is safe only because of the total mine count. When a border group is too large to list every layout, the percentages become close estimates (the page says so), but cells marked safe or mine stay certain: each one is proven by searching for a layout where it is not, and finding none.

We tested the solver on hundreds of small random boards against a brute-force count of every possible mine layout: every percentage matched and every certain cell was right. On 120 randomly dealt boards up to expert size, every cell it called certain matched the actual hidden mines.

Impossible boards

If something was copied wrong, the solver says what cannot be true, for example a 2 that has only one hidden neighbor, a 1 that already touches two flags, or a group of numbers that no mine layout satisfies. The numbers involved are outlined on the board.

Tips

  • Open the cells with a check mark first; each new number usually makes more cells certain.
  • When nothing is certain, the lowest percentage is your safest guess, but it is still a guess.
  • Use Flag the certain mines to keep your copy in step with the game.
  • Example deals a random board, opened from a safe first click, to try the solver on.

To play a full game with this solver behind the hint button, use minesweeper online, which also offers no-guess boards.

Solver tested . Found a problem? Tell us.

Questions

Can minesweeper always be solved without guessing?

No. Some positions give no certain safe cell at all, for example two hidden cells that look exactly the same to every number. Then the best you can do is click the cell with the lowest chance of a mine, which the solver works out for you.

Why does the total number of mines matter?

It changes how likely each layout of the border is. A layout that puts fewer mines on the border leaves more for the rest of the board, and there are far more ways to spread those, so the count shifts every percentage. Sometimes it decides a cell outright.

Are the percentages exact?

Yes, for normal boards: every layout that fits the numbers is counted. Only when one undecided area is huge does the solver switch to close estimates and say so on the page. Certain cells are always proven.

What does a 0 mean for its neighbors?

A 0 touches no mines, so all eight cells around it are safe. Most games open them automatically; if you copy a 0 with hidden neighbors, the solver marks them safe.

Do my flags have to be right?

The solver treats flags as mines. If a flag is wrong, the numbers around it usually stop adding up and the solver reports which number cannot be satisfied.