Hitori, Explained

After reading this you will know how a hitori puzzle enforces its three rules, why a good puzzle has exactly one solution, and how to shade cells with logic instead of guessing.

What hitori is and one hook example

Hitori starts as a square grid filled with numbers. Your job is to shade some cells black so that the numbers you leave white obey three rules at once. The name comes from a longer Japanese phrase meaning "let me alone", which fits: you are pulling out duplicate numbers and isolating what remains.

Here is a small 5x5 example. The starting grid on the left has repeats in several rows and columns. In the solution, the cells marked with an X are shaded.

A 5x5 hitori: the starting grid and the shaded cells (X) in its unique solution
RowCol 1Col 2Col 3Col 4Col 5
14232 X5
222 X143
33 X54 X14
4144 X32
55125 X3

Check row 1 after shading: the two 2s are down to a single white 2, so no number repeats. Column 4 had 2, 4, 1, 3, 5 with a duplicate 2 handled elsewhere; here shading the top 2 in that column removes the clash with row 1. The three rules below decide every one of those X marks.

The three rules, stated precisely

Uniqueness
Among the white (unshaded) cells, no number may appear more than once in any single row or any single column. Shaded cells are ignored for this count.
No adjacency
Two shaded cells may not share an edge. Diagonal contact is allowed. So a shaded cell forces its four orthogonal neighbours to stay white.
Connectivity
All the white cells must form one connected region, reachable from each other by moving up, down, left or right. No white cell or group may be walled off.

These three pull against each other, and that tension is the whole puzzle. Uniqueness pushes you to shade duplicates. No adjacency stops you from shading two neighbours to fix two clashes at once. Connectivity stops you from shading a cluster that traps a white cell. A correct solution satisfies all three with no exceptions.

A number appearing twice in a row does not tell you which copy to shade. It tells you that at least one must go. Often the choice is forced only when you combine it with the column clashes and the adjacency rule several steps later.

When to use hitori, and when not

Reach for hitori when you want a logic puzzle that needs no arithmetic and no marking of candidates the way sudoku does. A solver works purely with "shade or keep" decisions, so the state of every cell is binary. That makes hitori friendly for a first pen-and-paper logic session and easy to grade: you either broke a rule or you did not.

Skip hitori if you want number placement rather than number removal. If your goal is to fill empty cells, the Sudoku Generator or the KenKen (Calcudoku) Generator fit better. If you want a picture to emerge, the Nonogram Maker is the right choice. Hitori is about deciding what stays, not what goes in.

Counting the search space and why uniqueness is hard

Every cell is shaded or white, so a raw n \times n grid has this many shading patterns before any rule applies:

2^{n^2}

Here n is the side length and n^2 is the number of cells. For a 5x5 grid that is 2^{25} = 33{,}554{,}432 patterns. For 9x9 it is 2^{81} \approx 2.42 \times 10^{24}. Almost all of these fail at least one rule, but the count shows why brute force is hopeless at the larger sizes and why the generator uses a backtracking solver that prunes early.

The no-adjacency rule alone cuts the count sharply. On a 5x5 board the number of ways to place non-adjacent shaded cells (an independent set on the grid graph) is 1,346,695, about 4 percent of 2^{25}. Uniqueness and connectivity then filter that down to the handful of patterns that make a valid puzzle. The generator's promise is stronger still: after choosing numbers, it runs the solver to confirm that exactly one shading pattern satisfies all three rules. A puzzle with two solutions is rejected and rebuilt.

The base-10 logarithm of the raw pattern count grows from 7.5 at 5x5 to 24.4 at 9x9, so each step up roughly multiplies the space by a factor of thousands.

A worked example with the default puzzle

Solving the 5x5 above step by step

Work only with the three rules. No guessing is needed.

  1. Column 3 has 3, 1, 4, 4, 2. The two 4s sit in rows 3 and 4, which are adjacent. You cannot shade both (no adjacency), and you cannot keep both white (uniqueness). So exactly one of them is shaded. Hold that.
  2. Row 3 has 3, 5, 4, 1, 4. The two 4s are in columns 3 and 5. Column 5 also holds 5, 3, 4, 2, 3. If you shaded the row-3 column-5 cell, column 5 would still have another issue, so test the alternative: shade the row-3 column-3 4 instead.
  3. Shading row 3, column 3 resolves the column-3 4s (step 1) and the row-3 4s at once. That is the efficient move: one shaded cell settles two clashes.
  4. Row 2 has 2, 2, 1, 4, 3. The two 2s are in columns 1 and 2. Column 1 has 4, 2, 3, 1, 5 with no other 2, so keeping column 1 white is safe; shade the row-2 column-2 2.
  5. Row 1 has a repeated 2 with column 4. Column 4 reads 2, 4, 1, 3, 5, and row 5 column 4 holds a 5 that duplicates column 4's own... check instead the row-1 clash: shade row 1 column 4 to leave a single 2 in row 1.
  6. Row 4 column 3 and row 5 column 4 fall out from the remaining duplicates. Confirm connectivity: trace the white cells and verify they form one region. They do, and no two X cells touch. The pattern in the first table is the unique solution.

Start with pairs where the two duplicates are adjacent. Adjacency plus uniqueness forces exactly one of them to be shaded, which is the strongest opening deduction hitori offers.

Reading difficulty and the shading fraction

Difficulty in hitori tracks how many cells must be shaded and how long the deduction chains run. A useful summary is the shading fraction, the share of cells that end up black:

f = \frac{s}{n^2}

Here s is the number of shaded cells and n^2 the total. In practice a valid hitori shades between about 20 and 32 percent of its cells, because the no-adjacency rule caps how dense the shading can be. On a 5x5 grid an easy puzzle might shade 5 cells (f = 0.20) while a hard one shades 8 (f = 0.32). More shaded cells means more duplicates were planted, so more of your moves must chain together before any single cell is forced.

At a middling shading fraction of 0.26 the number of black cells rises from about 6 or 7 on a 5x5 to roughly 21 on a 9x9, following n squared times f.

On a 7x7 grid (49 cells), a shading fraction of 0.20 shades about 10 cells, 0.26 shades about 13, and 0.32 shades about 16. Higher fractions plant more duplicates and lengthen the deductions you must chain.

Common mistakes to avoid

The three errors below account for most failed solves.

  • Shading both copies of a duplicate. Uniqueness only requires that no more than one copy stays white. Shading both is legal for uniqueness but usually breaks adjacency or connectivity, and it is never necessary.
  • Ignoring connectivity until the end. A shading choice that isolates even one white cell is wrong, even if uniqueness and adjacency look fine. Check that white cells stay connected as you go, not only at the finish.
  • Treating a number that appears once as safe forever. A single copy of a number in its row can still clash with a copy in its column. Read both directions for every white cell.

When two duplicates in the same line are separated by exactly one cell, that middle cell is often forced white, because shading it plus one neighbour would leave the far duplicate stranded or break adjacency. Do not shade the gap without checking both sides.

Related puzzles on this site

If hitori's binary shade-or-keep logic appeals to you, several nearby generators use the same style of single-solution reasoning. The Futoshiki Generator and the Skyscrapers Puzzle Generator both build on Latin-square uniqueness with extra constraints. The Slitherlink Generator and the Hashiwokakero (Bridges) Generator share hitori's connectivity flavour, since both hinge on a single connected structure. For pure number placement with sums, try the Kakuro Generator.

Frequently asked questions

Can every hitori puzzle be solved without guessing?

Every puzzle this generator produces can. It verifies a unique solution with a backtracking solver before showing you the grid, and unique-solution hitori is always reachable by pure deduction. If you feel stuck, a longer chain of the same three rules exists, not a coin flip.

Why can two shaded cells touch diagonally but not along an edge?

The rule bans only shared edges. Two shaded cells at a diagonal share a single corner, not an edge, so white cells can still travel around them. Allowing diagonal contact keeps connectivity possible even at higher shading fractions.

How many cells get shaded in a typical puzzle?

Between about 20 and 32 percent. On a 5x5 that is 5 to 8 cells; on a 9x9 it is 16 to 26. The no-adjacency rule makes fractions above roughly 34 percent impossible to place on most grids.

Does the size of the numbers matter?

No. Numbers are labels only. A grid using 1 through 5 plays the same as one using any five distinct symbols. What matters is which cells hold equal labels in the same row or column.

What is the smallest interesting hitori?

A 5x5 is the smallest this tool builds and already forces real deduction chains. Below that, the rules leave too few duplicates to require more than one or two forced moves.