Leadlight

Sliding Puzzle Solver

This sliding puzzle solver works right on this page. Choose 3×3, 4×4 or 5×5, enter the puzzle you are stuck on, and it checks the position and then shows the moves one step at a time.

Enter your puzzle here

The frame not loading? Open the solver on the main page instead.

How to use the sliding puzzle solver

The solver is the Solver button on the Leadlight title screen, and the frame above opens straight into it. It always draws numbered tiles, whatever puzzle you are stuck on.

  1. Pick a size. 3×3, 4×4 or 5×5. The 4×4 board is the classic 15 puzzle. Sizes above 5×5 exist only in free play, not in the solver.
  2. Fill in the board. The solver starts in Fill in mode. Tap the square where tile 1 sits, then tile 2, and carry on in number order. You never tap the gap: once every numbered tile is down, the one square left over becomes the gap.
  3. Fix a slip. Tap the tile you placed last to take it back, or press Undo.
  4. Or edit instead. Press Solved for a finished board, then tap two tiles to swap them. Shuffle deals a random board that can be solved, which is handy for a first try.

Working from a picture puzzle? Number the pieces by where they belong: row by row from the top left, with the gap in the bottom right corner. Then copy each piece's number to the square where it sits now.

The solver in Fill in mode with tiles 1 to 4 placed and the message asking for tile 5

What the solver checks first

Before it searches, the solver looks at your finished board and gives one of three answers:

  • Already solved. Nothing to do, so it asks you to swap some tiles first.
  • Not solvable. The board is one that no sequence of slides can reach.
  • Can be solved. The Solve it button lights up.

A 3×3 board entered into the solver, with the message that this position can be solved

Press Solve it and the answer arrives as a walk-through. Next moves one step forward and Back moves one step back. Auto plays the whole thing and Pause stops it. The first-step button returns to the start, and Edit takes you back to your board. At every step the pane to slide glows, with an arrow and a line such as "Slide the glowing pane down".

Why half of all boards cannot be solved

Exactly half of all arrangements of a sliding puzzle can never be solved by sliding. Swapping any two tiles of a solvable board flips its parity, and no slide ever flips it back. That is why a puzzle someone has pried apart and rebuilt can end up impossible, and why the old 15 puzzle with only tiles 14 and 15 swapped has no solution.

When the solver says a board is not solvable, it explains this and shows a Swap two tiles to fix button, which swaps tiles 1 and 2 and checks again. If you are holding a real puzzle, the likelier cause is a tile you copied wrongly, so check the board against your puzzle before you give up on it.

The solver saying a position is not solvable, with the Swap two tiles to fix button

Shortest answer or just a good one?

The solver labels what it found, and the label tells you how much to trust the move count.

  • Shortest possible: N moves. The search proved no shorter answer exists.
  • A good solution, N moves (shortest not proven). The search ran out of time before proving it, so a shorter answer may exist.
  • Row-by-row method, N moves (not the shortest). The answer built the way you would build it by hand.

On 3×3 and 4×4 the solver searches for the shortest answer first. On 5×5 it always uses the row-by-row method. In one test run on a shuffled 5×5 board it came back with a 207-move answer and that label, so expect a long but valid walk-through.

A 5×5 answer labelled as the row-by-row method, 207 moves, not the shortest

A worked example: the hardest 3×3 board

The most moves any solvable 3×3 board needs is 31. One board that needs all of them reads 8 6 7 on the top row, 2 5 4 in the middle, and 3, the gap and 1 on the bottom. To enter it, tap these squares in order:

Tile Square
1 bottom right
2 middle left
3 bottom left
4 middle right
5 centre
6 top middle
7 top right
8 top left

The bottom-middle square is left over, so it becomes the gap. The solver reports "Shortest possible: 31 moves". For comparison, the row-by-row method that Leadlight uses as its fallback solves the same board in 39 moves, 8 more than the shortest.

Step 7 of 31 in the solver, with a glowing pane and the message to slide it down

Learn to solve it yourself

A sliding puzzle solver is the quickest way out of a jam, but the method it falls back on is easy to learn. Read how to solve a sliding puzzle for the four stages, then play a sliding puzzle with pictures or numbers and check yourself against the Hint button. The daily scramble gives you three new boards each day, each with a par to beat.

Sliding puzzle solver questions

Is the solver free?
Yes. There is no sign-in, no download and no payment. The search runs in your browser, so the board you enter stays on your device.
Can it solve a picture puzzle?
Yes, as long as you can number the pieces. Count the places row by row from the top left, put the gap in the bottom right corner, and enter each piece's number where it sits now.
Which sizes does it handle?
3×3, 4×4 and 5×5. The 4×4 size is the classic 15 puzzle. A 6×6 board exists in free play on large screens, but the solver does not take it.
Why does it say my board cannot be solved?
Half of all arrangements are unreachable by sliding. Usually a tile was copied wrongly, or two tiles were swapped when the puzzle was taken apart. Check each tile against your puzzle, or use the swap button to see whether swapping tiles 1 and 2 makes it solvable.
Is the answer always the shortest?
Not always. On 3×3 and 4×4 the solver tries to prove the shortest answer and says so when it does. On 5×5 it uses the row-by-row method, which is valid but longer.
Can I use it on my phone?
Yes. Every control is a tap target, and the frame on this page is sized for a phone screen.
Does Leadlight have hints without the solver?
In play, the Hint button shows the next move from the same kind of search, and Peek shows the finished picture for a moment. The solver is for a board you are stuck on, in this game or anywhere else.

Leadlight is a free sliding puzzle game with stained-glass pictures, a daily scramble and 64 levels. You can play it on the home page.