About the Sudoku Solver
This sudoku solver finishes any standard 9×9 puzzle. Type or paste the grid row by row — digits for the givens and a dot or 0 for each empty cell — and it returns the completed grid, the solution as one 81-digit line, and a step-by-step list of the cells it could fill by pure logic. Spaces, line breaks and grid lines such as | or + are ignored, so you can paste puzzles from most websites and apps.
Use it to check your answer, get unstuck on a hard newspaper puzzle by looking at just the next logical step, verify that a puzzle you created has exactly one solution, or find mistakes: if two equal digits share a row, column or box, it names them instead of guessing.
The solver first applies the two techniques human solvers use most — naked singles and hidden singles — and records each placement. When a puzzle needs harder techniques, it completes the grid with a fast backtracking search and tells you how many guesses that took, then keeps searching for a second solution to confirm the puzzle is unique.
How to use the sudoku solver
- 1Type or paste the puzzle row by row, using . or 0 for each empty square.
- 2Make sure there are exactly 81 cells — grid lines and spaces are ignored.
- 3Read the solved grid, or copy the 81-digit solution line.
- 4Stuck? Look at just the first few rows of the logical steps table for a hint.
- 5Check the status to see whether the puzzle has one solution, several or none.
Formula and method
Every empty cell starts with the candidates 1 to 9, minus any digit already used in the same row, column or box. A naked single is a cell with only one candidate left; a hidden single is a digit that can go in only one cell of a row, column or box. The solver repeats these two rules until no more cells can be filled, logging each placement as a step.
If cells remain, it uses depth-first backtracking: it picks the empty cell with the fewest candidates, tries each one, and backs up whenever a cell runs out of options. It continues after the first solution to look for a second, which tells you whether the puzzle is unique. Searches are capped at 200,000 steps, far more than any published 9×9 puzzle needs.
- R#C#
- Row and column of a cell, counted from the top-left (R1C1)
- Box
- One of the nine 3×3 blocks, numbered left to right, top to bottom
Worked examples
Classic puzzle (30 clues)
The default grid is a well-known 30-clue puzzle. Naked and hidden singles alone complete it, and the search confirms there is no second solution, so the status reads “unique solution”. The first row resolves to 5 3 4 6 7 8 9 1 2.
Typo with two 5s in the first row
The third cell was entered as 5, but row 1 already has a 5 in the first cell. The solver stops and names the conflict instead of producing a wrong answer.
Puzzle with too few clues
With only the first row filled, there are many valid grids. The solver shows one completion and reports that at least two solutions exist, so this is not a proper sudoku.
Frequently asked questions
How do I enter a sudoku puzzle?+
Type the 81 cells row by row, left to right. Use digits 1–9 for given numbers and a dot (.) or zero (0) for blanks. You can put each row on its own line and include spaces or grid lines; they are ignored.
Can every sudoku be solved?+
Every valid sudoku can. This solver finds a solution for any grid that has one and tells you when the givens contain a duplicate or lead to a contradiction, which usually means a typo in the puzzle.
What is the minimum number of clues for a sudoku?+
A 9×9 sudoku with a unique solution needs at least 17 clues. This was proved by an exhaustive computer search published in 2012, so any puzzle with 16 or fewer givens has more than one solution.
What are naked singles and hidden singles?+
A naked single is a cell where only one digit is still possible. A hidden single is a digit that has only one possible cell left in a row, column or box. Together they solve most easy and medium puzzles.
Why does the solver say it needed search steps?+
Hard and expert puzzles need techniques beyond singles, such as pairs, X-wings or chains. Rather than list every technique, the solver finishes those cells with a quick backtracking search and reports how many steps it took.
How can I use it for a hint without spoiling the puzzle?+
Look only at the first rows of the logical steps table. Each row tells you one cell, its digit and the reason, so you can take a single step and carry on solving yourself.