Hashi solver

Type the islands of your hashi (bridges) puzzle and the solver draws every single and double bridge, then checks that it is the only solution.

Type each island's number (1 to 8) in its cell and leave the water empty. Arrow keys move between cells.

Solver

Examples (each has exactly one solution)

Paste or copy the grid as text

How to use the hashi solver

This hashi solver (the puzzle is also called bridges or hashiwokakero) draws every bridge of your puzzle. Choose the grid size, type each island's number in its cell, leave the water empty and press Solve. Bridges appear as single or double lines, and the solver tells you whether the solution is unique. Grids up to 15 by 15 can be set up in the editor and up to 25 by 25 pasted as text.

The rules

  • Each island shows how many bridges end at it, from 1 to 8.
  • Bridges run in straight lines, across or down, between two islands with only water in between.
  • Two islands are joined by at most two bridges.
  • Bridges never cross each other or pass over an island.
  • In the end every island is connected to every other one through the bridges.

The solver rejects grids it can tell are broken before searching: an island needing more bridges than its neighbors allow (an island that can see only two others has room for 4 bridges at most), or numbers that add up to an odd total, which is impossible because every bridge counts at both of its ends.

Is the answer unique?

Like every solver on this site, it keeps looking after the first answer. A well-made hashi has exactly one; if your grid has two, both are shown so you can compare them, and if it has none the solver says so. Every answer is checked: each island has its number of bridges, no two bridges cross, and all islands are connected.

How the solver works

Each pair of islands that face each other across open water is a possible bridge with 0, 1 or 2 lines. The solver keeps a smallest and a largest value for each of them and narrows them with the same reasoning you would use on paper:

  • if an island's number equals everything its possible bridges could still carry, all of them are at their maximum (a 4 in a corner with two neighbors gets two double bridges);
  • if the other bridges of an island cannot reach its number without this one, this one needs at least the difference;
  • a bridge that is built blocks every bridge that would cross it;
  • all islands must still be reachable, and a finished group of islands that is closed off from the rest is a dead end.

Only when this reasoning stops does it try a value and continue. Four of the five examples on this page, including the 15 by 15, are solved by this reasoning alone; the 9 by 9 needs a single guess. Our test suite checks the solver against a brute force over every possible bridge layout of small puzzles, and against bridge networks generated at random.

Tips for solving by hand

Start with islands whose number is twice their count of neighbors (a 4 with two neighbors, a 6 with three, an 8 with four): every bridge is double. A 1 next to another 1 never joins it when there are other islands, because the pair would be cut off. Then work outwards, and watch for bridges that would block a crossing path.

Two related puzzles: nurikabe, where the numbers give island sizes and the sea must stay connected, and hidato, a path of consecutive numbers through the grid.

Want to play one from scratch? The bridges puzzle page makes new island maps at three sizes, with a daily map.

Solver tested . Found a problem? Tell us.

Questions

Is hashi the same as bridges?

Yes. Hashiwokakero is the Japanese name, often shortened to hashi; in English it is usually called bridges. The rules are the same.

Can a 1 connect to another 1?

Only if they are the only two islands in the puzzle. Otherwise the pair would be complete and cut off from every other island, which breaks the rule that all islands must be connected.

What is the most bridges an island can have?

Eight: two bridges in each of the four directions. So an 8 always has double bridges on all four sides.

Why does the solver say my puzzle has no solution?

No layout gives every island its number without crossings while connecting them all. Check for a number typed in the wrong cell; the solver already rejects odd totals and islands that need more bridges than their neighbors allow.

Is my puzzle uploaded?

No. The solver runs in your browser and nothing you type leaves your device.