How Sudoku Leader Makes Its Puzzles

No puzzle on this site comes from a stored list. Each one is built on your own device, in a few milliseconds, from a single number. This page explains how that works, and how we make sure every board has exactly one solution.

It starts with the Puzzle ID

Every board you play has a 10-digit Puzzle ID, shown next to the timer. On the classic boards the ID reads like this: 10 for a classic grid, two digits for the size (09 for 9×9), one digit for the level (1 is Easy, 4 is Expert, 5 is Pro), and five random digits. The whole number is then used as the starting value, or seed, for a random number generator.

The generator is a very old and simple one, known as Park and Miller’s “minimal standard” generator: multiply the current value by 16,807 and keep the remainder after dividing by 2,147,483,647. It is not suitable for cryptography, but it has one property that matters a lot here. The same seed always produces the same sequence of numbers, on any computer. That sequence drives every random choice the engine makes, so the same ID always leads to the same puzzle.

Step 1: fill a complete grid

The engine starts with an empty grid and fills it cell by cell, left to right and top to bottom. For each cell it shuffles the digits 1 to 9 into a random order and tries them in that order, keeping the first one that doesn’t clash with its row, column or box. If it reaches a cell where no digit fits, it steps back to the previous cell and tries that cell’s next digit. This method is called backtracking. On a 9×9 board it finds a complete, valid grid in well under a millisecond.

Step 2: remove numbers, checking after every one

Next the engine shuffles the list of all 81 cell positions and walks through it, removing one number at a time. After each removal it hands the board to a separate solver whose only job is to count solutions. The solver stops as soon as it finds a second one, because a second one is all it needs to see.

  • If the board still has exactly one solution, the number stays removed.
  • If a second solution exists, the number goes back and the engine moves on to the next cell.

The engine keeps going until it has removed as many numbers as the level asks for, or until it runs out of cells it can safely empty. That second case explains something you may have noticed. An Expert puzzle aims for 56 empty cells but sometimes keeps a few more numbers, because every remaining removal would have allowed two answers. The same thing happens on Evil Sudoku, which aims for 61 empty cells and in practice keeps between 21 and 28 starting numbers, 24 on a typical board.

The solution counter has to be fast, since it runs once for every cell the engine tries to remove. Each row, column and box stores the digits it already contains as a single binary number, so finding the candidates for a cell takes one calculation instead of a scan of the board. It always branches on the empty cell with the fewest candidates, which makes it quick even on a 25×25 board with 625 cells. On the giant grids each check also gets a fixed work limit. If a check can’t prove that a removal is safe within that limit, the number simply stays, so a board can end up with a few extra starting numbers but never with two solutions.

Step 3: grade the hardest tiers

For most levels, the number of removed cells decides the level. Our two hardest classic tiers are different. The generator builds a board, solves it with human techniques to find the hardest one it needs, and discards the board unless it is hard enough. Pro on the home page keeps a board only if it needs naked pairs or something harder, and Evil Pro keeps only boards our grader cannot finish at all. What those levels contain, measured over hundreds of boards, is in our article on Sudoku difficulty levels.

Because each attempt draws a new set of random digits, the board that passes the test has its own Puzzle ID. Anyone who opens that ID later gets the same accepted board straight away, without repeating the grading.

The same number, on every device

Puzzle IDs are what make sharing work. Send a friend the ID or the challenge link, and their phone rebuilds exactly the board you played. Our printable puzzle sheets rely on it too: each printed puzzle carries a QR code containing its ID, and scanning it opens the same board online.

A bug we found and fixed. Until October 2026 the engine shuffled digits with a common JavaScript shortcut, sorting the list with a random comparison. The JavaScript standard leaves the outcome of that trick up to each browser engine, and when we tested it, Chrome and Node.js built different boards from the same seed. On 3 of our 8 printable pages, the printed puzzle and the board its QR code opened did not match. We replaced the shortcut with a proper Fisher-Yates shuffle and now test the same IDs in Node.js, Chrome and Edge. The catch was that every Puzzle ID mapped to a new board once, when the fix went live with our move to a new platform in October 2026.

Killer Sudoku: making the cages work

Killer Sudoku adds cages: groups of cells whose digits must add up to a given total. The engine builds the solved grid first, then divides it into random cages and writes in their sums. Most random cage layouts are not unique on their own. In our testing only about 1 layout in 30 had a single solution from the cage sums alone.

To fix that, the engine finds two different solutions that fit the cages, picks a cell where they disagree, and reveals the correct digit in that cell. That one starting number rules out the second solution. It repeats this until only one solution is left, which usually takes just a handful of starting numbers. The easier Killer levels then add extra starting numbers on top. The hardest level adds none.

Samurai Sudoku: five grids at once

A Samurai Sudoku is five 9×9 grids joined at the corners, with 369 playable cells. The centre grid shares a 3×3 box with each of the four outer grids. The same remove-and-check method runs across all five grids together, so a removal is only kept if the whole board, shared boxes included, still has one answer. Our Daily Samurai board builds its seed from the date instead of a random number. Across 120 consecutive days, every daily board started with exactly 185 of its 369 cells filled.

Checking puzzles you bring yourself

The same solution counter powers our tools. Type a puzzle from a newspaper or a book into the Sudoku Solver and it will tell you whether the puzzle has one solution, several or none, instead of quietly showing the first answer it finds. The Sudoku Generator runs the same check when you build your own grid, and won’t call it a valid puzzle until it has exactly one solution.

Why one solution matters

A puzzle with two solutions can’t be solved by logic alone. At some point you have to guess, and if you guess wrong the puzzle may still look fine until the last few cells. A unique solution means every number on the board can be worked out from the numbers already there. That is the promise behind every board on Sudoku Leader, from a 4×4 for a first-time player to a 625-cell Titan.