๐Ÿ”ข Sudoku Generator

Generates a random sudoku puzzle at your chosen difficulty (easy, medium, or hard). Every generated puzzle is verified internally to have exactly one solution, so you can solve with confidence. Stuck? You can reveal the solution at any time.

How to use

  1. Choose a difficulty to generate a new sudoku puzzle.
  2. Click an empty cell to select it, then enter a number using the number pad below.
  3. Cells with a conflicting duplicate are highlighted in red. Fill the whole board correctly to win.

How the calculation works

Generate a 9ร—9 sudoku and solve it on screen. Fill the empty squares so that every row, column and 3ร—3 box contains each digit from 1 to 9 exactly once. How puzzles are made 1. Build a random, completely filled valid grid 2. Empty squares one at a time in random order, each time checking with a solver that there is still exactly one solution 3. Put back any square whose removal would allow a second solution So every puzzle has exactly one answer. Difficulty is set by the target number of starting clues (easy 40, medium 32, hard 26).

Worked example

Easy: about 40 clues (41 empty) Medium: about 32 clues (49 empty) Hard: about 26 clues (55 empty) In 2012 an exhaustive computer search proved that a sudoku with a unique solution needs at least 17 clues.

Things to be aware of

  • On hard, sometimes no more squares can be emptied without allowing a second solution, so a few more than 26 clues may remain.
  • The basic technique is to look for squares where only one digit fits in that row, column and box.
  • If you get stuck, Show Solution reveals the answer.

FAQ

Is the generated puzzle really guaranteed to have a unique solution?

Yes. Every time a cell is emptied out, an internal solver checks that no other solution exists, so the resulting puzzle always has exactly one solution.

What if I get stuck?

Click โ€œShow Solutionโ€ to reveal the correct answer at any time.

How is the difficulty determined?

By the target number of starting clues: 40 for easy, 32 for medium and 26 for hard. Squares are only emptied while the solution stays unique, so on hard in particular a few more clues than the target can remain.