Search for a tool
Sudoku Solver

Tool/Solver to resolve sudoku/wordoku grids (directly or step by step). The aim of the sudoku game is to fill the rows and columns of a 9x9 grid with each digit only once.

Results

Sudoku Solver -

Tag(s) : Number Games

Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Feedback and suggestions are welcome so that dCode offers the best 'Sudoku Solver' tool for free! Thank you!

# Sudoku Solver

## Solve a sudoku grid

 Resolution Compute all solutions Step by Step Solution

### What is a Sudoku? (Definition)

Sudoku is a puzzle game whose goal is to fill a grid with the numbers from 1 to 9 (there are variants with letters or symbols) so that they appear only once per row, column or block.

### How to fill the Sudoku grid?

Make a copy/paste or type directly in cells. Letters (Wordoku/alphadoku) and digits are accepted.

Example: Copy the Sudoku content in the first cell (top left) 97 1 5 5 9 2 18 4 8 7 26 92 3 6 2 9 19 4572 to get:

 9 7 ␣ 1 ␣ ␣ ␣ ␣ 5 ␣ ␣ 5 ␣ 9 ␣ 2 ␣ 1 8 ␣ ␣ ␣ 4 ␣ ␣ ␣ ␣ ␣ ␣ ␣ ␣ 8 ␣ ␣ ␣ ␣ ␣ ␣ ␣ 7 ␣ ␣ ␣ ␣ ␣ ␣ ␣ ␣ ␣ 2 6 ␣ ␣ 9 2 ␣ ␣ 3 ␣ ␣ ␣ ␣ 6 ␣ ␣ ␣ 2 ␣ ␣ 9 ␣ ␣ ␣ ␣ 1 9 ␣ 4 5 7 2

### How does the step by step works?

The program solves the 9x9 sudoku much like a human would, calculating the possible values in each box and making deductions.

Only possible value indicates that, in this box, any other value (1-9) results in an error/inconsistency (in a row, column or region).

Only box possible indicates that all other boxes (within a block/region) cannot contain the value.

For each validated box/number, the solver displays an additional step in its progress in order to understand.

Sometimes the reasoning arrives at a stage where no quick logical deduction allows to deduce the value of a box (several possible values). The solver then analyzes the boxes where there are the fewest possibilities and selects a value that it considers the most probable and continues, if an inconsistency occurs (that the sudoku has no more solution) then it returns to step selection and takes another value. To optimize the chances, the selection is not random, the choice is made on a number which, if it is positioned in the box, will allow the maximum deduction for the next sudoku steps. This method is the fastest for the solver, it may be that sometimes a slower and complex deduction could achieve the same result.

### What is a block of Sudoku?

In a sudoku, the 9x9 grid presents 9 squares of 3x3 which are called blocks (or regions, or groups, or sectors or sub-grids).

### How to test if a sudoku has a unique solution?

dCode calculates all the solutions for the sudoku, not only the first one. To check a homemade sudoku, the solver can confirm that there is only one solution.

### When was Sudoku invented?

The first Sudoku versions are from 1979

### How many distinct sudokus exist?

A single row can consist of $9!$ (Factorial of 9) different ways, same for the columns, but the whole sudoku has a number of possibilities much less than $9!^9$, because some permutations can lead to identical grids. The total number of grids would be $9! \times 72^2 \times 2^7 \times 27704267971 = 6670903752021072936960$ combinations.

### What is the minimum number of starting squares for a unique solution?

For a sudoku to have only one solution, it must have at least 17 pre-filled boxes out of the 81 total. Gary McGuire and his team proved this here by using an algorithm to perform a systematic computer search. They first cataloged the 5,472,730,530 distinct sudoku puzzles. Next, they created a program to check whether sudoku puzzles with 16 pre-filled squares had a unique solution. Their exhaustive search found no sudoku with only 16 pre-filled squares having a unique solution, thus confirming the minimum number of 17 pre-filled squares needed.

### Does a rectangular sudoku or non square sudoku exist?

By keeping the sudoku NxN rules that require the N characters to be used on each row and column, then it is impossible to respect them if the sudoku is not square.

Some variants of the square sudoku, however, use non-square inner blocks (see sudoku 6x6, sudoku 7x7 or sudoku 8x8)

## Source code

dCode retains ownership of the "Sudoku Solver" source code. Except explicit open source licence (indicated Creative Commons / free), the "Sudoku Solver" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or the "Sudoku Solver" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for "Sudoku Solver" are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!
Reminder : dCode is free to use.

## Cite dCode

The copy-paste of the page "Sudoku Solver" or any of its results, is allowed (even for commercial purposes) as long as you credit dCode!
Exporting results as a .csv or .txt file is free by clicking on the export icon
Cite as source (bibliography):
Sudoku Solver on dCode.fr [online website], retrieved on 2024-09-09, https://www.dcode.fr/sudoku-solver

## Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!