By Mian Ali Khalid · Published · How we build and test tools
How to use the sudoku solver
- Type or paste your 9x9 puzzle into the text area, using 0 or . for empty cells.
- The sudoku solver processes the grid automatically as you type.
- If a unique solution exists, the solved board appears below along with its status.
- To use the sudoku checker, paste a fully filled 9x9 grid to verify it follows all rules.
How the backtracking algorithm works
A backtracking solver fills empty cells one at a time, trying digits 1 through 9. When a digit violates a row, column or 3x3 box constraint, the algorithm backtracks to the previous cell and tries the next candidate. This depth-first search finds a solution if one exists within the search limit.
To determine uniqueness, the solver continues searching after the first solution is found. If a second valid arrangement is discovered, the puzzle has multiple solutions. The search is capped at 100,000 nodes to keep the browser responsive even on degenerate inputs like an empty grid.
Validating a Sudoku grid
The sudoku checker built into this tool verifies three constraints for every filled cell:
- Row rule: each of the nine rows contains digits 1 through 9 with no repeats.
- Column rule: each of the nine columns contains digits 1 through 9 with no repeats.
- Box rule: each of the nine 3x3 sub-grids contains digits 1 through 9 with no repeats.
If any given digit violates these rules, the grid is rejected immediately before solving begins. A completed grid that passes all three checks is a valid solution.
Minimum clues and puzzle difficulty
A standard 9x9 Sudoku puzzle requires at least 17 givens (pre-filled cells) to guarantee a unique solution. Mathematicians proved in 2012 that no 16-clue puzzle can have exactly one answer. Fewer givens generally means more searching, though difficulty also depends on which cells are given, not only how many.
| Givens | Typical difficulty | Notes |
|---|---|---|
| 17 to 22 | Hard to expert | Requires advanced techniques or deep backtracking |
| 23 to 30 | Medium | Solvable with basic logic in most cases |
| 31 to 40 | Easy | Many naked singles and hidden singles available |
| 41 to 81 | Trivial | Few or no empty cells remain |
Input formats accepted
This sudoku solver accepts several common input styles. You can paste a single string of 81 characters, nine lines of nine characters, or comma-separated values. Zeros and dots represent empty cells; spaces, commas and line breaks are ignored, so mark every blank with 0 or a dot. For example, the following are equivalent:
53..7....6..195...(single line with dots)530070000600195000...(single line with zeros)- Nine separate lines of nine digits each
All non-digit characters except 0 through 9 and dots are stripped during parsing, so formatting from newspapers or websites usually works without manual cleanup.
Worked examples
| Example | Input | Result |
|---|---|---|
| Easy puzzle | Puzzle (81 characters, 9 per row): 53..7....6..195....98....6.8...6...34..8.3..17...2...6.6....28....419..5....8..79 | Status: Solution found (unique); Givens: 30; Empty cells: 51 |
| Hard 17-clue puzzle | Puzzle (81 characters, 9 per row): ..3.2.6..9..3.5..1..18.64....81.29..7.......8..67.82....26.95..8..2.3..9..5.1.3.. | Status: Solution found (unique); Givens: 32; Empty cells: 49 |
| Completed grid (checker) | Puzzle (81 characters, 9 per row): 534678912672195348198342567859761423426853791713924856961537284287419635345286179 | Status: Grid is already complete and valid; Givens: 81 |
FAQ
Can this sudoku solver handle any 9x9 puzzle?
Yes, for standard 9x9 puzzles. It uses a backtracking algorithm with a search limit of 100,000 placements; if that limit is hit the tool says so instead of guessing.
How does the sudoku checker work?
Paste a fully completed 9x9 grid. The checker verifies that every row, column and 3x3 box contains the digits 1 through 9 exactly once, with no duplicates.
What happens if my puzzle has multiple solutions?
The solver reports that multiple solutions exist and displays the first one found. Valid published puzzles always have exactly one unique solution.
Why was my grid rejected?
A grid is rejected if it does not contain exactly 81 cells (after ignoring characters other than digits and dots), or if the given digits already violate a row, column or box constraint.
Is my puzzle data sent to a server?
No. All solving and validation happens locally in your browser. Nothing is uploaded anywhere.
What is the minimum number of clues for a unique solution?
Seventeen. It has been mathematically proven that no 16-clue standard Sudoku puzzle can have exactly one solution.