Sudoku Solver
Solve any Sudoku puzzle instantly or generate a new one to practice.
About this tool
An interactive Sudoku solver that uses a backtracking algorithm to find the solution to any valid 9×9 Sudoku puzzle. Enter your puzzle by clicking cells and typing numbers, then press Solve to fill in the answer. Original numbers are shown in black, solver-filled numbers in blue, and invalid entries in red. Use the Random Puzzle button to generate a new solvable puzzle with pre-filled clue cells. Check validates your current progress without revealing the full solution. All logic runs entirely in your browser — no data is sent to any server.
How to use
- 1 Click a cell in the grid and type a number from 1 to 9.
- 2 Fill in the clues you know from your puzzle.
- 3 Press Check to highlight any conflicts in red.
- 4 Press Solve to automatically fill in the complete solution.
- 5 Press Random Puzzle to load a new practice puzzle.
- 6 Press Clear to reset the entire board.
The one rule that makes Sudoku solvable by a computer
A standard Sudoku is a 9×9 grid split into nine 3×3 boxes, and a valid solution obeys a single constraint: every digit 1 through 9 must appear exactly once in each row, each column, and each 3×3 box. That constraint is what lets software solve it. A solver doesn't need to "understand" the puzzle — it only needs to (a) try a candidate digit in an empty cell and (b) check whether that digit already exists in the cell's row, column, or box. If it does, the placement is illegal; if not, it's a valid step forward. This tool encodes exactly that check and drives it with a classic algorithm.
How backtracking finds the answer
The solver uses backtracking, a systematic trial-and-error search. It scans for the first empty cell and tries placing 1. If that's valid under the row/column/box rule, it moves on to the next empty cell and tries 1 there, and so on. When it reaches a cell where no digit 1–9 is legal, it knows an earlier guess was wrong, so it "backtracks": it erases the most recent placement, advances that earlier cell to the next candidate digit, and continues. This recursive process is guaranteed to either fill the whole grid — at which point a complete, valid solution has been found — or exhaust every possibility and report that none exists.
Crucially, backtracking never wastes time exploring branches that already violate the rules, because the validity check prunes them immediately. That pruning is why a method that sounds like brute force solves a typical puzzle in a few thousand operations rather than the astronomically larger number of raw grid combinations.
A worked example of a backtrack
Imagine the solver reaches a cell and places 4 because it's the lowest digit that doesn't yet appear in that row, column, or box. It proceeds two cells later and finds a spot where every digit from 1 to 9 conflicts with something already placed — a dead end. The algorithm undoes its way back to that earlier 4, sees 5 is also illegal, tries 6, and it fits. Now the previously impossible cell has room for a legal digit, and the search moves forward again. Multiply that pattern across the grid and you get the full solution. When you press Solve, the digits the algorithm filled in appear in blue, while your original clues stay black, so you can see exactly what was deduced.
How to use the tool well
- Click any cell and type a digit 1–9 to enter your puzzle's clues. Use the arrow keys to move between cells without reaching for the mouse.
- Press Check to validate your progress. Any cell that conflicts with another — a duplicate in its row, column, or box — turns red. Check never reveals the answer; it only flags contradictions in what you've entered.
- Press Solve to fill the complete solution. Clues stay black, solver-filled cells appear blue.
- Press Random Puzzle to load one of the built-in practice puzzles, or Clear to reset the board.
All of this runs entirely in your browser — the grid you type and the solution computed from it are never sent to any server.
What "No solution found" really means
If the solver reports no solution, the clues you entered are contradictory — the same digit appears twice in some row, column, or box, making any complete fill impossible. It is almost never the algorithm failing; it's a typo in the input. Press Check first to see exactly which cells clash, fix them, and solve again. Note also that if a puzzle happens to have more than one valid solution (an under-clued grid), backtracking returns the first one it reaches, which is a legitimate answer even if it isn't unique.
Common mistakes
- Transposing a clue. A single misplaced given digit can make a perfectly fine puzzle unsolvable. Double-check against your source before assuming the solver is wrong.
- Treating Check as a solver. Check only highlights conflicts; it won't tell you a value is correct, only that it isn't currently illegal.
- Expecting hints toward a unique solve path. This is a solver, not a logic tutor — it computes an answer rather than teaching the human-style elimination techniques (naked pairs, hidden singles) you'd use by hand.