History & Mathematics · 11 min read

How Sudoku Puzzles Are Made

A Sudoku puzzle is not written the way a crossword is. Nobody sits down and composes the clues. A puzzle is excavated — you begin with a complete, valid grid and remove digits one at a time for as long as the puzzle survives having them removed. Everything interesting about construction lives in that word “survives”, and in the separate question of how you then decide what to call the result.

Step one: a complete grid

The starting point is any of the 6,670,903,752,021,072,936,960 valid complete Sudoku grids — a figure computed by Bertram Felgenhauer and Frazer Jarvis in 2005 through a combination of clever symmetry reduction and brute-force enumeration. The mathematics guide covers where that number comes from and why it shrinks to about 5.47 billion once you discard grids that are relabellings or reflections of one another.

Generating one is easy. Walk the cells in order, and at each one try the digits 1–9 in random sequence, keeping any that does not conflict with the row, column or box so far. If a cell has no legal digit, back up and try the previous cell differently. This is ordinary backtracking search, and because valid grids are extraordinarily plentiful it terminates almost immediately — the search rarely has to back up more than a few cells.

A subtlety that matters more than it appears: the randomisation must be genuine. A generator that always tries digits in the same order, or always fills cells in the same sequence, will produce grids clustered in a small corner of the space, and the resulting puzzles will feel repetitive in ways solvers notice long before they can articulate.

Step two: digging out the clues

Now the actual construction. Repeatedly pick a filled cell, remove its digit, and ask the essential question: does the puzzle still have exactly one solution? If yes, the removal stands. If no, put the digit back and try a different cell. Continue until no further cell can be removed without creating ambiguity.

That uniqueness check is the whole cost of the process. Answering it means running a solver that does not stop at the first solution but continues searching to establish that no second one exists. Since this runs after every candidate removal, and a puzzle involves fifty-odd successful removals plus many rejected attempts, a generator performs hundreds of full solves per puzzle produced. Uniqueness is not a nicety — it is what makes the puzzle a logic problem rather than a search problem, and it is the property that lets a solver legitimately reason about the solution being unique, as the uniqueness guide discusses at length.

The result of digging until nothing more can be removed is a minimal puzzle: one where every remaining clue is load-bearing, and removing any of them would admit a second solution. Most published puzzles are minimal, and it is a satisfying property — nothing on the board is redundant.

Note what minimal does not mean. It does not mean fewest possible clues. Which cells you happen to try first determines where you end up, and different orders on the same starting grid produce minimal puzzles with different clue counts. Getting near the proven floor of 17 clues requires vastly more than greedy digging; the exhaustive search that established 17 as the minimum, completed by Gary McGuire, Bastian Tugemann and Gilles Civario in 2012, consumed roughly 7.1 million core-hours.

Why symmetry is decoration

Newspaper Sudoku almost always shows a grid with 180-degree rotational symmetry: if a clue sits at row 2 column 5, another sits at row 8 column 5. This is inherited from crossword convention, where symmetric grids are a genuine aesthetic standard, and it is purely cosmetic here. Symmetry constrains nothing about difficulty and does not affect uniqueness.

It does cost something. A symmetric generator removes clues in mirrored pairs, which means each removal must clear the uniqueness test for both cells at once. That is a stricter condition, so symmetric puzzles typically end up with a handful more clues than an unconstrained dig on the same grid would produce. You are paying a few clues for a pleasing shape — a reasonable trade for print, and irrelevant to the logic.

Step three: grading, and why it is the hard part

Now the constructed puzzle needs a difficulty. The naive approach — count the clues — is close to useless. Clue count and difficulty are only weakly related. Plenty of 22-clue puzzles fall to singles alone, while some of the hardest puzzles ever constructed carry 21 to 23 givens. What determines difficulty is not how many cells are empty but what kind of reasoning the empty cells demand.

The serious approach is to grade with a logical solver: a program that solves the way a person does, using named techniques rather than backtracking search. It holds a candidate grid and repeatedly applies the cheapest technique available — singles first, then locked candidates, then subsets, then fish — recording each one it uses. Because it never guesses, the record it produces is exactly the list of techniques a human would need.

From that trace, several things can be read off:

  • The hardest technique required. The dominant factor in human difficulty, and the one this site uses directly as its label.
  • How many hard steps there are, and how they are spaced. One X-Wing that unlocks a long cascade of singles is a pleasant puzzle. Three separate advanced steps with dry stretches between them is a punishing one, even though both are labelled by the same peak technique.
  • How wide the search is at each step. The same pattern is objectively harder to find in a densely populated grid region than a sparse one — difficulty is perceptual as well as logical, and this is the component that is hardest to quantify.

Most publishers compress all of this into a single star rating, which is where the information is lost. The difficulty ratings guide covers why one paper's “fiendish” is another's “medium”, and why the compression is the problem rather than the raters.

Constructing to a specification

Generating a puzzle that requires exactly a chosen set of techniques — no more, no less — is harder than generating one and seeing what you get, and it is what this site's library is built on. The approach is generate-and-filter at scale: produce very many puzzles, grade each with the logical solver, record the full technique set for each, and keep the ones matching a target specification.

The catch is that the distribution is deeply uneven. Puzzles requiring nothing beyond singles are trivially abundant. Puzzles requiring a Swordfish and nothing harder are rare, because most grids that are difficult enough to demand a Swordfish also demand something else along the way. Filling out the sparse corners of the specification space takes orders of magnitude more generated candidates than the common ones, which is why the technique picker can guarantee a puzzle needs precisely the patterns you selected: the search has already been done and the results indexed.

This is also why the counts shown on the practice pages vary so widely between techniques — they are the honest population of the library, not a quota.

What makes a puzzle good, as opposed to valid

Uniqueness and a difficulty rating make a puzzle correct. They do not make it enjoyable, and the difference is where construction becomes a craft rather than a pipeline. A few properties separate the two:

  • Steady progress. A good puzzle yields at a reasonably even rate. A puzzle that gives up forty cells instantly and then presents a single brutal wall is rated by that wall but experienced as two unrelated puzzles glued together.
  • A payoff for the hard step. The best puzzles are built so that the one difficult deduction opens a cascade. Finding a Swordfish that yields one elimination and another stall is technically fine and emotionally flat.
  • No hidden leap. The stated difficulty should cover every step. The familiar experience of a “medium” that suddenly demands an X-Wing at step forty is a grading failure, and it is the specific failure that technique-labelling eliminates.
  • Spatial spread. Deductions distributed across the grid feel better than deductions clustered in one corner, which make two-thirds of the board dead space for most of the solve.

Grading these properties automatically is possible but genuinely difficult, and it is where most of the interesting remaining work in puzzle construction sits. Enumerating valid grids was settled in 2005. Establishing the 17-clue minimum was settled in 2012. Deciding which of two equally-rated puzzles is the better puzzle is still, for now, mostly a matter of taste.

If you want to see the output of the grading process directly, the worked walkthroughs show real boards immediately before and after each technique fires — which is the solver's trace, rendered.