gizmobench

Sudoku Solver

Type the givens into the grid, or paste 81 characters, and the rest fills in. Two things happen here that a solver which simply prints an answer cannot do. It counts solutions rather than stopping at the first, so a grid with two answers is reported as having two instead of one being quietly chosen for you. And it explains a square on request: press Next square and the easiest empty square is filled with the row, the column and the box that left it a single digit. Givens that contradict each other are named before any search starts, both squares and the row, column or box they share, so a mistyped digit reads as a mistyped digit and not as an unsolvable puzzle. Everything runs in this tab: no puzzle library, no account, nothing uploaded.

Empty grid0 givens

Type the givens into the grid, or paste 81 characters, then press Solve. Arrow keys move, a digit types, backspace clears.

Entry
Givens
0
Solutions
not solved yet

The grid is a keyboard: arrow keys move, a digit types, backspace clears, and Enter runs the button. A paste of 81 characters anywhere on the grid fills it, with a full stop, a zero or an underscore for an empty square. Your own digits show in white and every digit the solver filled in is coloured, and typing into a square clears the solver’s digits, since they answered the grid as it was before. A pair of squares that clash is marked in red as soon as the second of them is typed. Fill every empty square at once, and say how many solutions the grid has. The grid stays in this browser, and the page’s Start over button forgets it.

Three grids and what comes back

  • A newspaper puzzle30 givens
    solved, one solution
  • A grid with 16 givensunder the 17 a single answer needs
    solved, more than one solution
  • Two 5s in one columngivens that contradict each other
    no solution: R1C1 and R7C1 both hold 5
Counted, not guessed. The search fills the empty square with the fewest digits left to it, backtracks the moment a square has none, and carries on past the first answer to see whether a second exists. That is why the readout can say more than one: a puzzle with two solutions is a puzzle whose author left something out, and a solver that picks one of them without saying so is hiding that from you.
Accuracy. Exact: the answer satisfies every row, column and box, or the tool says the puzzle has none. It counts solutions as it searches, so it can tell you when a grid has more than one, and it cannot know which of those the puzzle author intended. Nothing is uploaded: the grid, the search and the counting all run in this tab, so it works with no connection once the page has loaded.

Common questions

How do I enter a puzzle?
Click or tab to a square and type. Arrow keys move around the grid, a digit types, backspace clears, and Enter runs whichever button is showing, so a whole puzzle can go in without touching the mouse. Every square is announced as its row and column, which is how a puzzle in a newspaper is usually numbered anyway. If you already have the puzzle as text, paste it: 81 characters, with 1 to 9 for a given and a full stop, a zero or an underscore for an empty square. Line breaks, spaces and tabs are ignored, so nine lines of nine and one long line of 81 both read the same. A paste that is the wrong length is refused with the count it actually had, and a paste with a letter in it names the letter and where it was, rather than filling the grid with something you did not mean.
What does it mean when a puzzle has more than one solution?
It means the givens do not pin down a single grid: two or more completions satisfy every row, column and box, and nothing in the puzzle chooses between them. A properly set puzzle has exactly one. The solver counts as it searches and stops at the second solution it finds, because the difference that matters is one answer or more than one, not how many more, so the readout says either 1 or more than 1. When it says more than 1, the digits on screen are still a real solution: they are one of the answers, just not the only one. That usually means a given was missed when the puzzle was copied in, and it is worth checking the grid against the source before blaming the puzzle.
Why do people say a puzzle needs at least 17 givens?
Because no arrangement of 16 givens has a single solution, and that is a proved result rather than a rule of thumb: an exhaustive computer search published in 2012 by McGuire, Tugemann and Civario checked every possibility and found none. Puzzles with exactly 17 do exist and are hard. This tool does not assume any of that, it counts solutions itself, so a 16-given grid comes back as more than one solution the same way any other ambiguous grid does. The givens count sits in the readout beside the solutions count, so a puzzle that arrived short is easy to spot: the second worked example below is a 16-given grid and the tool reports it as ambiguous.
Is anything uploaded?
No. The grid, the search and the counting all happen in this browser tab, and the page makes no request while you work: there is no puzzle library to fetch and no server to send your grid to. Once the page has loaded it keeps working with no connection at all. The grid in progress is kept in this browser alone so the page opens where you left it, and the Start over button at the top of the page forgets it. Copy grid puts the whole grid on your clipboard as nine lines of nine characters, which is a format this tool reads straight back in.
What does Step do when no square is obvious?
It says so. Choose Step and the button becomes Next square: it fills the square that its row, its column and its box decide between them, which is the move a hand solver makes first, and it prints those three lists so the reasoning can be checked. On a grid where no square is decided that way, it names the closest square and how many digits still fit there rather than guessing at one, and Solve finishes the puzzle from that point. Plenty of newspaper puzzles need nothing harder: the 30-given example below goes from start to finished grid on that one technique alone.
Can it check a grid I filled in myself?
Yes, that is what Check mine is for, and it gives three different answers. If two squares hold the same digit in a row, a column or a box, it names both squares and the unit they share. If nothing clashes, it goes further and tries to finish the grid from what you have written: a grid that can still be completed is reported as such with the number of squares left, and a grid where nothing clashes but no completion exists is reported as having a digit that is already wrong. That third answer is the useful one, because it catches a mistake made twenty squares ago that has not yet run into anything.

Exact: the answer satisfies every row, column and box, or the tool says the puzzle has none. It counts solutions as it searches, so it can tell you when a grid has more than one, and it cannot know which of those the puzzle author intended.