Guide · Sudoku
How to solve sudoku
Sudoku asks for one thing: fill the grid so every row, every column and every 3 by 3 box holds the numbers 1 to 9 exactly once. There is no arithmetic in it. What makes a puzzle easy or hard is how you find the next square, and that is what this guide teaches, in the order you will need it.
Updated
The rules, and the words for things
The grid has 81 squares, called cells, in nine rows, nine columns and nine 3 by 3 boxes. Some cells start filled in; those are the givens. Your job is to fill the rest so that no number repeats in any row, column or box. A number that could still go in a cell is a candidate for it.
A proper sudoku has exactly one solution, so you never need to guess. Every number can be worked out from what is already on the grid. The techniques below are just ways of seeing that reasoning faster. Rows and columns are counted from the top left.
Start by scanning
Pick a number and a box, and ask where in that box the number can go. Every 7 already on the grid rules out its whole row and its whole column. Cross those off, and often only one cell in the box is left. That is a hidden single: the cell might have room for other numbers, but it is the only place this number fits.
Start with the number that already appears most often on the grid. The more copies of it there are, the more rows and columns are ruled out, and the more boxes collapse to a single cell. Work through each box for that number, then move to the next most common one. On an easy puzzle, scanning alone can take you a long way.
The only number left
The other way round: pick a cell and ask which numbers it can hold. Look along its row, down its column and around its box. If eight different numbers already appear among them, the ninth is the answer. That is a naked single.
Naked singles are easiest to spot in a crowded row, column or box. Whenever a unit is down to two or three empty cells, check each one: the missing numbers are few, and one of them usually has only one possible home.
When to start pencil marks
When scanning stops finding anything, write the candidates in. A candidate is a small number in the corner of a cell, noting that it could still go there. Two ways work:
- Mark only the pairs. Write a candidate only when a number has just two possible cells in a box. It keeps the grid clean, and it is enough for most medium puzzles.
- Mark everything. Write every candidate in every empty cell. It takes a few minutes and it is what the techniques below work on, so it is the way to go on a hard puzzle.
Either way, the rule that keeps you out of trouble is the same: every time you place a number, erase it from the candidates of every cell in its row, column and box. Most solving mistakes are a stale candidate nobody crossed out. The sudoku you can play on this site has a Notes mode that writes candidates in the corners for you, with an undo.
Pointing pairs
Sometimes a number is not pinned to one cell in a box, but it is pinned to one row of it. That is still useful. If every place left for a 4 in a box lies on the same row, the 4 for that row has to be inside this box, so no other cell in the row can be a 4.
It works the other way too, sometimes called box-line reduction: if every place for a number in a row lies inside one box, that number cannot go anywhere else in the box. Both versions remove candidates rather than place a number, but a removal is often what turns a stubborn cell into a single.
Naked and hidden pairs
If two cells in the same row, column or box have the same two candidates and nothing else, those two numbers belong to those two cells. You do not know which way round yet, but you know neither number can go anywhere else in that unit. That is a naked pair.
A hidden pair is the same idea seen from the numbers' side. If 2 and 7 can each go in only the same two cells of a box, those cells must hold 2 and 7, even if they show other candidates too. Erase everything else from them. The pattern stretches to three: three cells sharing three candidates between them form a naked triple, and three numbers confined to the same three cells form a hidden triple.
X-wing and XY-wing
The X-wing is the first technique that looks across the whole grid. Find a number that has exactly two possible cells in one row, and exactly two in another row, in the same two columns. The four cells form a rectangle. Whichever way the number lands, it takes one cell in each of the two columns, so it can be erased from every other cell in those columns.
The same works with columns and rows swapped, and with three rows instead of two, which is called a swordfish.
An XY-wing uses three cells with two candidates each. A middle cell, the pivot, holds X or Y. It can see one cell holding X or Z and another holding Y or Z. If the pivot is X, the first cell must be Z; if it is Y, the second must be Z. Either way one of them is Z, so Z can be erased from any cell that sees both of them.
What our puzzles actually need
Each printable set here is chosen by grading, not only by how many numbers are given. Every puzzle goes through a solver that works the way this guide does, always reaching for the simplest technique that makes progress, and stays in its set only if the hardest technique it needs suits the level:
- Easy needs nothing but singles.
- Medium needs at least one hidden single, so scanning matters, and never more than pairs and triples.
- Hard needs at least a pointing pair, so pencil marks earn their keep, and never more than the X-wing family above.
Grading by givens alone gets this wrong more often than you might expect. Before the sets were graded, one of the twelve medium grids needed more than a swordfish, which made it harder than most of the hard set, and two of the hard grids needed chains this guide does not teach. Those were swapped out. The table shows the sets as they are now.
Puzzles in each set, by the hardest technique needed
| Set | Given numbers | Singles only | Pointing pairs or pairs | X-wing or XY-wing |
|---|---|---|---|---|
| Easy | 42 | 12 of 12 | 0 of 12 | 0 of 12 |
| Medium | 32 | 11 of 12 | 1 of 12 | 0 of 12 |
| Hard | 26 | 0 of 8 | 7 of 8 | 1 of 8 |
Every easy puzzle can be finished with the simplest technique of all: find a cell with only one number left, fill it, repeat. You never even need to scan. No puzzle in any set needs a technique this guide does not teach, so if one has you stuck, the answer is somewhere in the checklist below.
When you are stuck
Go through these in order. The answer is almost always early in the list.
- Scan every number again, box by box. A placement since your last pass may have opened one up.
- Check each row, column and box with only two or three cells left.
- Fill in candidates, if you have not, and look for a cell with just one.
- Look for a number confined to one row or column of a box, and clear it from the rest of that line.
- Look for pairs: two cells with the same two candidates in one unit.
- Check your work. If a number repeats anywhere, or a cell has no candidates left, something earlier was wrong. The quickest repair is to go back to the last point you were sure of.
One shortcut works on any grid: every row, column and box adds up to 45. If a unit is missing a single number, add up what is there and subtract from 45. It is rarely faster than looking, but it is a useful check.
Where to practice
The easy set is the place to get fast at singles, the medium set is where scanning becomes a habit, and the hard set is where you will want pencil marks. Each prints with its answers. To practice on screen, play an easy sudoku in the browser, with Notes, undo and a check that flags a repeated number. And if you want a fresh grid at any difficulty, the sudoku generator makes one with a single solution, every time.