The Magic Codex

Sudoku Solver

Stuck on a puzzle? Type the givens into the grid and get the full solution — invalid and unsolvable puzzles flagged, not hung.

Tap a cell and type 1–9. Digits auto-advance; arrow keys move around. Leave unknown cells blank.

How to use the Sudoku Solver

  1. Enter the givens — tap each cell and type the digits your puzzle starts with; leave the rest blank.
  2. Press Solve — the solver checks the puzzle is legal, then fills every empty cell.
  3. Read the verdict — a full solution with its step count, or a clear message if the puzzle is invalid or unsolvable.

Invalid vs unsolvable

An invalid puzzle has a digit repeating in a row, column, or 3×3 box — almost always a copying typo. An unsolvable puzzle is subtler: every digit is legal where it sits, yet the givens contradict each other so no completion exists. The solver checks validity first (instant), then searches exhaustively before declaring a puzzle unsolvable — it never gives up early.

How it works under the hood

The solver is a classic backtracking search sharpened by the MRV heuristic (minimum remaining values): at each step it branches on the empty cell with the fewest legal digits, so dead ends surface immediately instead of after thousands of wasted guesses. That single trick is what lets it crack Arto Inkala's "world's hardest" 2006 puzzle in a fraction of a second. Everything runs locally in your browser — the puzzle never leaves your device.

How does the Sudoku solver work?
It uses backtracking with the MRV heuristic: at every step it picks the empty cell with the fewest legal digits and tries each one, backing out when a choice leads nowhere. That keeps even the 'world's hardest' Arto Inkala puzzle solvable in well under a second, entirely in your browser.
What does 'invalid puzzle' mean?
A puzzle is invalid when a digit already repeats in a row, column, or 3×3 box — usually a typo while copying the puzzle from a newspaper or app. The solver flags it immediately instead of searching forever.
What does 'unsolvable' mean if the puzzle is valid?
A puzzle can be perfectly legal — no repeated digits — and still have no solution, because the givens quietly contradict each other. When the search exhausts every possibility without completing the grid, the solver tells you the puzzle itself is broken.
Can it solve the world's hardest Sudoku?
Yes — press 'Load example' to fill in Arto Inkala's famous 2006 puzzle, often called the world's hardest, then press Solve. The MRV heuristic cracks it in a fraction of a second.
Do I have to fill the whole grid before solving?
No — just enter the givens (the digits your puzzle starts with) and leave the rest blank. The solver fills every empty cell. You only need at least one given digit to start.
Is my puzzle sent anywhere?
No. The solver is pure JavaScript running in your browser. Nothing is uploaded, stored, or tracked.

Need help with this tool?

Found a bug, or have a suggestion for the codex? Write to us — a real human reads every message.

[email protected]

More from the codex