Nonogram solver

Paste the row and column clues of your nonogram (picross, griddlers, hanjie) and get the picture, with every line deduction explained. Grids up to 40 by 40.

Solver

This nonogram solver works on the puzzle you type in. Enter the row clues in one box and the column clues in the other, one line per row or column, and press Solve to see the finished picture. Press Next step instead to watch it being solved one line at a time, each step with its reason, the way you would do it on paper.

How to enter a nonogram

Type each clue as numbers separated by spaces, in order from left to right (for rows) or top to bottom (for columns). A row with the clue 3 1 2 is typed 3 1 2. Use 0 for an empty line. The number of lines you type sets the size of the grid, so 15 row lines and 20 column lines make a 15 by 20 puzzle. Commas work as separators too, so a list copied from elsewhere usually pastes straight in.

To make your own puzzle, switch to Draw a picture, pick a size and tap or drag over the grid. The clues are written as you draw, and Solve then tells you whether your picture has only one solution, which is what a fair nonogram needs.

How the solver works

The core is a line solver. For one row or column it considers every way the blocks of the clue could be placed, given the cells already known, and keeps the cells on which all those placements agree: a cell filled in every placement must be filled, a cell empty in every placement must be empty. It does this with a dynamic program that runs in time proportional to the line length times the number of blocks, rather than listing the placements one by one. Every time a cell changes, the crossing line is checked again, until nothing more follows.

When the lines stall, the solver tries probing: it assumes a cell is filled and follows the line logic; if some line can then no longer match its clue, the cell must be empty (and the other way round). Only if probing also stalls does it fall back to trial and error, and it keeps searching after the first answer so it can tell you whether the puzzle has exactly one solution. The step list shows only the line and probing steps, because those are the ones a person can follow.

The line solver is tested against a brute-force check of every possible filling on thousands of random lines, and every answer is checked against all the clues before it is shown.

Worked example

In a row of 10 cells with the clue 8, the block can start in cell 1, 2 or 3. In every case it covers cells 3 to 8, so those six cells are filled before anything else is known. With the clue 4 4 in 10 cells, the first block covers cells 2 to 4 at least, and the second covers cells 7 to 9. This overlap rule, applied to every row and column in turn, solves most published puzzles.

Solving tips

  • Start with the big clues: add the blocks plus one gap between each, and if the total is close to the line length, the middle cells are certain.
  • Mark empty cells with a dot or cross as soon as you know them; they matter as much as the filled ones.
  • When a block is complete, the cells on both ends must be empty.
  • If you are stuck, look for a line where only one block can reach a known filled cell.

A logic grid puzzle uses the same kind of grid with checks and crosses, but its clues are sentences instead of numbers. For a black-and-white grid ruled by digits, try binairo.

To play rather than solve, try our nonograms online: 5x5 to 15x15 grids that can all be finished line by line.

Solver tested . Found a problem? Tell us.

Questions

What is the difference between a nonogram, picross and griddlers?

None, apart from the name. Nonogram, picross, griddlers, hanjie, paint by numbers and pic-a-pix are all names for the same black-and-white puzzle with number clues on each row and column. This solver handles the black-and-white kind; colored nonograms are not supported.

How big a nonogram can it solve?

Grids up to 40 by 40 can be entered. Puzzles that line logic can solve finish in a fraction of a second even at that size. A grid with very many possible answers, such as a random sparse pattern, may hit the 30 second limit; the solver then shows how far logic got.

Why does the solver say my nonogram has more than one solution?

Some clue sets fit more than one picture; the simplest case is two cells on a diagonal, which can go either way. The solver shows two different pictures and marks the cells that differ in yellow, so you can see where the ambiguity is.

What does 'the row clues add up to a different number than the column clues' mean?

Both sets of clues describe the same picture, so their totals of filled cells must be equal. When they are not, one of the numbers has been typed wrong or skipped. The message gives both totals.

Can I solve it myself and only get help when stuck?

Yes. Press Next step whenever you are stuck: it shows one deduction with the line it comes from, highlighted on the grid. Show every step lists the whole chain.