Skip to content
Puzzle Quarry

How to Solve a Nonogram

One real 20×20, from an empty grid to a finished drawing. Every move below is the move the solver made, in the order it made it.

Biggest numbers first, then the ends, then the awkward lines

Open by looking for the longest number on the board rather than by starting at the top left. A long run in a line has nowhere to hide: wherever it sits, it covers the middle of the space available to it, and every one of those cells can be filled before anything else is known. On a twenty-cell line a fourteen gives you eight cells for free. Sweep the whole board for these once, thoroughly, and you will have a scattering of filled cells to work from.

Then work in from the two ends of every line that has anything settled at either of them. A line whose first cell is known — filled or blank — is a shorter line than it looks, and re-running the same arithmetic on what is left is the cheapest second pass there is. Alternate rows and columns while you do it, because every cell a row gives you lands in a column that has not been looked at since.

Only when both of those have run dry is it worth sitting down with a single awkward line. That is what the three harder arguments are for, and each of them costs real attention — which is precisely why they should not be reached for while something free is still on the table.

One 20×20, from the first row to the picture

The board below is a real one from the daily library, graded expert, and it was chosen because its solve happens to need all five arguments on the ladder and to meet them in ladder order — the first cheap one on move one, and the hardest not until move a hundred. The five positions shown are the five moments where something new is being used; the hundred moves in between are more of the same.

Read each pair of boards left to right. On the left is the position as it stood, with the numbers the argument read marked and the cells it decides outlined. On the right is the same position a moment later. A dark cell is part of the picture, a cell with a cross has been proved blank, and a plain cell is one nobody has decided yet — which on this puzzle is a real third state rather than an absence.

  1. Before anything is marked, find the longest numbers. Row ten reads 12 in a twenty-cell line, so wherever that run sits it covers the middle four cells — push it hard left and hard right and those four are in both placements. Nothing on the board was read to get them.

    The position
    003510121213138108108138131212105300
    2
    4
    2
    2
    2
    2
    2
    6
    10
    12
    44
    44
    12
    14
    16
    16
    16
    14
    12
    10
    A moment later
    003510121213138108108138131212105300
    2
    4
    2
    2
    2
    2
    2
    6
    10
    12
    44
    44
    12
    14
    16
    16
    16
    14
    12
    10

    Overlap

  2. Twenty moves of the same arithmetic later, the sweep runs out. Row nine now has settled cells at its ends, which makes it a shorter row than it looks — and the same overlap arithmetic run again on what is left of it gives two more cells straight away.

    The position
    003510121213138108108138131212105300
    2
    4
    2
    2
    2
    2
    2
    6
    10
    12
    44
    44
    12
    14
    16
    16
    16
    14
    12
    10
    A moment later
    003510121213138108108138131212105300
    2
    4
    2
    2
    2
    2
    2
    6
    10
    12
    44
    44
    12
    14
    16
    16
    16
    14
    12
    10

    Working in from the ends

  3. Now the crosses start earning their keep. Row twelve has been cut into pockets by cells already proved blank, and its numbers can only be dealt out among those pockets in order. One pocket is too short for anything that could reach it, so all of it is blank.

    The position
    003510121213138108108138131212105300
    2
    4
    2
    2
    2
    2
    2
    6
    10
    12
    44
    44
    12
    14
    16
    16
    16
    14
    12
    10
    A moment later
    003510121213138108108138131212105300
    2
    4
    2
    2
    2
    2
    2
    6
    10
    12
    44
    44
    12
    14
    16
    16
    16
    14
    12
    10

    Gaps and splitting

  4. With the walls in place, a block can be attached to a run. Row nine holds a filled block hard against a proved blank, so whichever number that block belongs to must start exactly there — and every candidate is long enough to carry it several cells further.

    The position
    003510121213138108108138131212105300
    2
    4
    2
    2
    2
    2
    2
    6
    10
    12
    44
    44
    12
    14
    16
    16
    16
    14
    12
    10
    A moment later
    003510121213138108108138131212105300
    2
    4
    2
    2
    2
    2
    2
    6
    10
    12
    44
    44
    12
    14
    16
    16
    16
    14
    12
    10

    Glue

  5. And at the very end, one line that gives way to nothing cheaper. The top row has to be taken in all at once: every legal placement of its numbers written out, the ones contradicted by a mark thrown away, and the two cells the survivors all agree about filled in.

    The position
    003510121213138108108138131212105300
    2
    4
    2
    2
    2
    2
    2
    6
    10
    12
    44
    44
    12
    14
    16
    16
    16
    14
    12
    10
    A moment later
    003510121213138108108138131212105300
    2
    4
    2
    2
    2
    2
    2
    6
    10
    12
    44
    44
    12
    14
    16
    16
    16
    14
    12
    10

    The whole line at once

what the reasoning read what it decides what it wrote

A hundred more moves of the same five ideas, and every cell is decided. The drawing turns out to be a guitar.

The finished drawing
003510121213138108108138131212105300
2
4
2
2
2
2
2
6
10
12
44
44
12
14
16
16
16
14
12
10

When the board stops moving

Look for the line with the least slack rather than the line with the most numbers. Slack is the length of the line minus what the numbers and their compulsory gaps already take up, and a line with two or three spare cells is nearly determined even when it looks blank. It is the cheapest thing to compute and the most reliable place to find a move.

If that fails, check the lines you finished ten minutes ago. A line whose numbers are fully accounted for has every remaining cell blank, and crossing those off is free — but it is easy to fill the last run of a row and move on without ever going back to cross out the rest of it. Those uncrossed cells are missing walls, and missing walls are why two of the five arguments have nothing to say.

And if both come up empty, pick one line and be systematic: write out where the first number could start, then the second, and see what every one of those arrangements agrees about. It is slow and it always works. What the board never wants is a guess, because every board published here was checked to be finishable without one.

Common questions

What is the first move in a nonogram?

Find the longest number on the board. A run longer than half its line must cover the middle of that line wherever it sits, so those cells can be filled before anything at all has been read.

Should I work on rows or columns first?

Neither in particular — alternate. Every cell a row gives you lands in a column nobody has looked at since, so sweeping all the rows and then all the columns is the natural rhythm.

Why do I keep getting stuck halfway through?

Usually because finished lines were never crossed out. A line whose numbers are all placed has every other cell blank, and those crosses are the walls that two of the five arguments depend on.

More Nonogram pages