Home / JavaScript

Sudoku Solver

Enter the given digits into the boxes below and click "solve" to find a valid solution. Click "reset" to clear the grid.


An exhaustive search of all possible answers is surprisingly effecient for sudoku. This is because it is often possible to rule out reasonable fractions of the possibility space by only making a few guesses. Nonetheless, this solver uses a variety of techniques to get as far as possible without resorting to brute force. These techniques are described in detail within the reduce_all() function in the source code. Artificial delay is introduced into this solver so that you can see its progress. For this resaon, efficiency was not much of a concern while writing it. Note that this solver, because it can use brute force, will find a solution to any initial condition for which a solution exists, including an empty board.

When tested on puzzles from sudoku.com, all puzzles up to expert difficulty can be solved without brute force. "Evil" difficulty puzzles, however, consistently require it. Requiring the solver to guess is probably what makes these puzzles "evil".