Sudoku Generator & Solver

Generate Sudoku puzzles at four difficulties — and solve any puzzle you paste in.

Open tool

Overview

The Sudoku Generator and Solver creates new 9x9 Sudoku puzzles at four difficulty levels — easy, medium, hard, and expert — and also solves any puzzle you paste in. Generated puzzles always have a unique solution, and the solver reports whether a pasted puzzle is uniquely solvable, has multiple solutions, or is contradictory.

Sudoku has a deceptively simple rule set: every row, every column, and every 3x3 box must contain the digits 1 through 9 exactly once. From that single constraint, an enormous puzzle space emerges. The solver supports the full range of human-style techniques as well as a brute-force backtracking fallback for pathological puzzles, and the generator produces clean, well-shaped puzzles suitable for printing or solving on screen.

How it works

Generation starts by constructing a complete random 9x9 grid using a randomised backtracking algorithm. The solver then repeatedly removes a clue and confirms uniqueness — if removing the clue leaves the puzzle with more than one solution, it's restored. Difficulty is controlled by the number of clues remaining and by the techniques the unique-check uses: easy puzzles are solvable by naked singles and hidden singles, expert puzzles require chains and forcing nets.

The solver applies constraint propagation first (naked singles, hidden singles, locked candidates) and only falls back to depth-first search if propagation stalls. For uniqueness checking it counts the first two solutions found; any puzzle with two solutions is rejected as ambiguous, ensuring every distributed puzzle has exactly one correct fill.

Examples

  • An easy puzzle exposes about 35-40 of the 81 cells and is solvable by naked-single chasing.
  • A medium puzzle exposes about 30 cells and requires hidden singles or locked candidates.
  • An expert puzzle exposes about 22-25 cells and may require X-wing, swordfish, or chain techniques.
  • The minimum number of clues for a uniquely solvable Sudoku is 17 (proven in 2012). The generator targets a higher floor for usability.

FAQ

Is every generated puzzle uniquely solvable?
Yes — generation rejects any layout with multiple solutions.

What's the hardest difficulty?
Expert puzzles require advanced techniques (X-wing, swordfish, chains) and typically take 20-40 minutes for experienced solvers.

Can I paste in any puzzle?
Yes. The solver accepts any 9x9 grid; it reports unique solution, multiple solutions, or contradiction.

Are puzzles printable?
Yes — the rendered grid prints cleanly to standard letter or A4 paper.

Does the solver explain its reasoning?
This build returns just the completed grid. Step-by-step solvers exist as separate tools.

Try Sudoku Generator & Solver

An unhandled error has occurred. Reload ×