Minesweeper Generator
Everyone who has played Minesweeper has lost a game to a square that could not be worked out. Two cells, one mine, nothing anywhere on the board to tell them apart — and the loss feels like your mistake when it was the board's. These boards are solved before they are offered, from the clues alone, and any board that reaches a position needing a guess is thrown away.
What this generator does
Produces a Minesweeper board together with the position the first click opens, and guarantees that the rest can be deduced from the numbers without ever guessing. The guarantee is the work: a solver plays each candidate board using only what a player can see, and any board it cannot finish is discarded and another generated. It also reports which techniques the solve actually needed, so the stated difficulty is measured rather than inferred from how many mines are on the grid.
How to use this tool
- Choose a width and height between 5 and 16, and how many mines to hide.
- Press Make board.
- The shaded squares are what the opening click reveals — that is your starting position.
- Work out where every mine is from the numbers. Print the grid, or reveal the mines when you are done.
Understanding the controls
- Width and height
- Between 5 and 16 squares each way. Size changes how long a board takes more than how hard it is — a 16x16 solved by counting alone is easier than a 9x9 that needs enumeration, which is why the difficulty shown is measured after the solve rather than guessed from the dimensions.
- Mines
- About one square in eight is the classic density — 10 on a 9x9, 40 on a 16x16. Raising it makes boards harder in a specific way: more of them need a guess and get discarded, so what you receive is drawn from a smaller and more interesting pool. Raise it far enough and none can be found at all, and the tool says so rather than serving one that needs a coin flip. Curiously it does not stay that way: pack a grid almost full and boards come back, because when nearly every hidden square holds a mine the total settles what the numbers cannot.
- Seed
- Leave it blank for a new board each time. Enter a word and the same board comes back, so a group can all work the identical grid, or a lost sheet can be reprinted exactly.
Worked examples
- Classic beginner
- 9x9 with 10 mines — usually gentle or steady, occasionally needing enumeration.
- Classic intermediate
- 16x16 with 40 mines — a longer board, and about a third of proposals are discarded.
- What gets thrown away
- Two hidden squares, one mine between them, nothing to separate them: discarded, not shipped.
- Reprintable
- The seed 'friday-quiz' always produces the same board.
Common use cases
- A logic exercise where every step can be justified rather than guessed
- Printable puzzles for a cover lesson, a club sheet or a quiet activity
- Practising the subset deductions that make the 1-2-1 patterns readable
- Teaching why a puzzle needs a guaranteed solution path to be a puzzle
- A reproducible board a whole group can work through together
How this generator works
The generator picks the opening click first and keeps that square and all eight of its neighbours clear of mines, which is the standard first-click rule and what guarantees the click opens a region rather than a lone number. It then scatters the mines at random, derives the adjacent counts, and hands the board to a solver that is given no access to the hidden layout — it reads the number under a square only once it has earned the right to open it, exactly as a player does. The solver applies three rules in ascending cost: counting, where a number equal to its hidden neighbours means they are all mines and a satisfied number means the rest are all safe; subsets, where one clue's hidden neighbours sit inside another's and the difference is forced, which is what makes the 1-2-1 and 1-2-2-1 patterns readable; and frontier enumeration, where every arrangement of mines consistent with all the clues is listed and a square that is a mine in all of them or none of them is settled. If that finishes the board, it is offered. If it reaches a position where nothing is forced, the board is discarded and another is proposed. Measured over 400 boards each, a random board is finishable 87.5% of the time at 9x9 with 10 mines and 46.0% at 9x9 with 15 — so the filter genuinely rejects work rather than waving boards through.
Randomness and fairness
The opening click and the mine positions are drawn with the browser's cryptographic random number generator. Everything after that is deterministic — the counts follow from the layout, and whether a board survives follows from the counts. A seed switches to a reproducible generator so the same board can be printed twice; that mode is deterministic, not cryptographic, which is exactly what makes it repeatable.
For how randomness is produced across the whole site, see how Generate Random works.
Assumptions this tool makes
- Each number counts the mines in the eight squares surrounding it, including diagonals, which is the standard rule.
- The first click is safe and opens a region, as it does in every modern implementation.
Limitations and good to know
- The board is not playable in the page — squares are not clickable. It shows the opening position and reveals the mines on request, for solving on paper or on screen by eye.
- Boards are capped at 16 squares each way. The enumeration rule works over the frontier of hidden squares touching known numbers, which stays instant at these sizes.
- The solver is deliberately conservative: it stops rather than guesses, and it also stops when the frontier is too wide to enumerate. That means some boards that a very strong player could finish are still discarded — the error is always in the safe direction.
- 'Finishable without guessing' describes the path from the opening click shown. It is a property of this board and this starting position, not of Minesweeper in general.
- Difficulty describes which techniques the solve needed, not how long it feels. A large gentle board can take longer than a small tricky one.
- Mine count and difficulty are not monotonic. On a 9x9 nothing guess-free is found anywhere between roughly 30 and 65 mines, and then boards reappear above that as the grid approaches full. The middle of that range is where the tool will decline, not the top of it.
Common mistakes
- Guessing when the board seems stuck
- No board here needs a guess. If nothing is moving, the information is somewhere you have not looked — usually a number two squares away whose neighbours overlap the ones you are staring at.
- Only marking mines
- Mark the squares you have proved safe as well. A square known to be clear constrains the numbers around it just as strongly as a mine does, and leaving it blank throws that away.
- Forgetting the total
- The mine count is part of the puzzle. Near the end it is often the only thing that settles the last few squares — if three mines are left and exactly three squares are hidden, they are all mines.
Practical tips
- Work the borders of the opened region first. Those numbers have the fewest hidden neighbours, so they are the ones most likely to be already satisfied or already full.
- When two numbers share hidden squares, subtract them. A 2 next to a 1 whose hidden squares are inside the 2's means the extra square is a mine — that single trick solves most of what counting cannot.
- For a group, use a seed and print once. Everyone working the identical board makes it possible to argue about a deduction rather than about a puzzle.
Troubleshooting
- I reached a contradiction
- Something earlier was marked on an assumption. Every board here is solvable by deduction alone, so a contradiction means a guess crept in — retrace to the last square you could prove.
- It says no board could be found
- That density is too high for a guess-free board to turn up. Reduce the mines, or enlarge the grid — the tool refuses to serve a board that needs a coin flip rather than quietly dropping the guarantee.
- The board looks too easy
- Raise the mine count. Difficulty here is measured from the techniques the solve required, so a board labelled gentle genuinely needed nothing but counting — denser grids force the subset and enumeration rules.
Privacy and your data
Nothing is entered and nothing is stored. Boards are generated in your browser, no grid is uploaded or written into the page address, and analytics records only that the tool ran — never a board, a seed or a solution.
Frequently asked questions
- How do you know it can be solved without guessing?
- Because it is solved before it is offered, by a solver that cannot see the hidden layout. It starts from the same opening click you are given and applies only deductions a player could make. If it finishes the board, no guess was needed anywhere along that path. If it gets stuck, the board is thrown away and another is generated. Boards are also re-checked independently: the counts are re-derived from the layout and the solve is re-run, so a board that only worked because the generator remembered something would fail.
- Why can I not click the squares?
- This generates boards rather than playing them. The page shows the opening position and will reveal the mines when you ask, which is what a printed puzzle or a solve-by-eye needs. A playable surface is a different product from a proved board, and only the second one is what is claimed here.
- What do gentle, steady and tricky mean?
- They come from the solve rather than from the density. Gentle means counting alone was enough. Steady means at least one subset deduction was needed — the 1-2-1 kind of pattern. Tricky means part of the board required enumerating every arrangement the numbers allow, because neither simpler rule moved. The reason shown under each board says which, and how many times.
- Why does a nearly full grid work when a half-full one does not?
- Because the total is a clue too. On a 9x9, no guess-free board turns up anywhere between about 30 and 65 mines — that is where the numbers leave genuine ambiguity. Above it the grid is so densely packed that almost every hidden square must be a mine, and the count of mines remaining settles the few that the adjacent numbers do not. Difficulty rises with density and then falls again, which is not what most people expect and is worth knowing before you assume a refusal means you asked for too many.
- Are the mines placed fairly?
- They are placed uniformly at random among the squares away from the opening click, and then filtered by solvability. That filter is not neutral: boards needing a guess are removed, so the boards you see are not a uniform sample of all boards with that many mines. That is the whole point, and it is worth being explicit about rather than calling the result simply random.
Related generators
- Nonogram GeneratorPrintable nonograms whose clues are proved to have exactly one solution, and to be solvable without guessing.
- Sudoku GeneratorPrint a sudoku with exactly one solution — 4x4, 6x6 or full 9x9, four difficulties, with the answer key and a seed to reprint it.
- Maze GeneratorPrint a maze with exactly one route from start to finish — three textures from long corridors to short dead ends, any size up to 40 by 40.