piapia123
en

Sudoku Solver and Generator

Convert

Everything runs locally in your browser — nothing is uploaded

Input
Drop a file here to load its contents
Output

Three modes: solve, check and generate. Solving uses backtracking with bitmask candidate sets and can list every step together with the strategy used (naked single, hidden single, or a backtracking guess). Checking reports which rows, columns and boxes contain a repeated digit and exactly where, and says whether the grid has one solution, several, or none. Generating digs holes out of a complete solution and verifies uniqueness after every removal, so the puzzle it hands you has exactly one answer. ⚠️ Generation draws from the random source in lib/random.ts, never Math.random; supplying a seed reproduces the same puzzle. Everything runs locally in your browser; nothing is uploaded.

Features

  • Paste nine lines to solve; . or 0 marks a blank, and an 81-character compact string works too
  • Optional step-by-step solution naming the strategy used at each step
  • Checking names the row, column and box of every repeated digit, down to the cell
  • Says whether the grid is uniquely solvable, has several solutions, or none, stopping the search at 2
  • Generates puzzles by digging holes and verifying uniqueness each time
  • Three difficulties: easy, medium and hard
  • A seed reproduces the same puzzle
  • Illegal input and duplicate digits are reported with exact row and column
  • Everything runs locally in your browser; nothing is uploaded

How to use

  1. Choose a mode: solve, check, or generate
  2. For solve and check, paste nine lines of nine cells, using . or 0 for blanks
  3. For generate, choose a difficulty and optionally a seed
  4. The result appears as you type, and every row can be copied

FAQ

How do you know whether a puzzle has a unique solution?
By backtracking search that stops after finding 2 solutions — an empty grid has about 6.67×10²¹ of them, so enumerating all would take centuries. For the question “is it unique”, the three answers 0, 1 and at least 2 are enough, so no more need to be listed.
Why is a generated puzzle guaranteed to be unique?
The generator digs holes out of a complete solution and immediately checks with that counter whether the puzzle is still unique after each removal; if not, the digit goes back. Without that step you would meet puzzles that look solvable but actually have several answers.
What are the three strategies in the steps?
Naked single: only one digit can go in that cell. Hidden single: a digit can only go in one cell of its row, column or box. Guess (backtracking): neither direct method progresses, so a digit is tried and the search backs out if it fails.
Why does a grid with repeated digits stop the solver?
Because a grid with duplicates has no solution at all; carrying on would only end with “no solution”, when the real problem is those repeated cells. The tool therefore points straight at the rows and columns involved.

Related tools