Sliding Puzzle Solver
Every puzzle has a next move. Let's find yours.
Set up your board and follow a solution, one satisfying slide at a time.
Interactive Puzzle
3 × 3 · CLASSICor use arrow keys ↑↓←→ to slide
Solver Controls
Browser-PoweredSolution ready
0 / 0 moves
Both fast and shortest modes find optimal moves on 3×3.
Enter custom numbers
Photo puzzle optional
Algorithm Comparison for This Layout
Compare search algorithms on this exact configuration. Peak states represents search tree frontier size.
| Algorithm | Result | Moves | Time | Explored | Peak states |
|---|
How to Use the Sliding Puzzle Solver in Three Steps
- 01
Enter Your Own Puzzle Layout
Choose a 3×3, 4×4 or 5×5 preset, or set 2–10 rows and columns. Shuffle a fresh board, or enter the tiles in reading order to match the puzzle in front of you. Use 0 for the empty square.
- 02
Let the Solver Find the Moves
Hit Solve my puzzle. We check whether the arrangement is solvable, then find a route. Choose Fast solution for large scrambles or Shortest solution to minimize moves.
- 03
Watch the Tiles Slide into Place
Play the solution or take it one move at a time. Each number in the move list tells you which tile to slide into the gap on your own board.
Solve Any Sliding Puzzle Size (3×3, 4×4, 5×5)
The rules stay the same: slide a neighboring tile into the blank until the numbers run from left to right, top to bottom, with the gap in the bottom-right corner.
- 3×3 · Classic. Eight tiles and one gap. A good place to learn how moving the blank helps you position the next tile.
- 4×4 · Challenge. The familiar fifteen puzzle. More space to maneuver, and more arrangements to search.
- 5×5 · Expert. Twenty-four tiles. Fast solution handles large scrambles in stages; finding the shortest route can take much longer.
Custom size and goal supports rectangles up to 10×10. Enter a target arrangement with the gap anywhere; Reset loads that goal and Shuffle starts from it.
Play the sliding block puzzleTurn Your Photo into a Sliding Puzzle
Turn a favorite landscape, pet photo or illustration into a picture puzzle. Choose a PNG, JPEG, WebP or AVIF file under 10 MB. It is cropped to your board shape locally, then divided into the same numbered grid.
The picture changes how the tiles look, not how they move. The number on each piece identifies the piece. Pieces follow your goal layout, with the goal's empty position hidden even when the puzzle is complete.
How the solver finds your next move
First, a parity check compares your start and goal. For the standard goal, odd-width grids need an even inversion count; even-width grids need an odd sum of inversions and the blank's row from the bottom. Custom goals are checked against their own parity.
On boards with up to nine cells, Fast and Shortest modes use bidirectional breadth-first search. For larger boards, Fast solution places boundary rows or columns while keeping the goal gap in the unfinished region, then finishes the last 2×2. Shortest solution uses IDA* with Manhattan distance and disjoint linear conflicts; completed results use the fewest moves.
A responsive page, even during a search
The search runs in a Web Worker, leaving the controls responsive. Cancel at any time, change the board or start again. Searches stop when their time or storage budget is reached; a limit is not evidence that a puzzle is impossible. The progress slider lets you jump to any step in a long solution.
Compare A* searches
Try A* with or without a closed set on the same layout. Completed searches are shortest. The closed set avoids revisiting states at an equal or greater cost; without it, duplicate states can use more storage. The results table compares moves, time, explored states and peak stored states. This storage count is a proxy, not a byte measurement.
Learn the pattern, not just the answer
Want to solve it yourself? Our How to Solve a Sliding Puzzle guide explains why you finish the top rows first and save the final two rows for paired columns.
Frequently asked questions
Is a sliding puzzle always solvable?
No. Half of all possible arrangements of distinct tiles are unreachable from the standard goal. The solver checks inversions and, for even-width boards, the blank's row before searching. The Shuffle button uses legal moves, so its boards are always solvable.
Will I get the shortest solution?
Fast and Shortest modes find a shortest solution on boards with up to nine cells. On larger grids, Fast solution prioritizes finding a route and may use extra moves. Choose Shortest solution for IDA* search: completed results use the fewest moves, but difficult positions can exceed the search budget.
Can I use a picture instead of numbers?
Yes. Choose an image to crop it to your board shape and split it across the tiles. Numbers stay visible as a reference to each tile's goal position. Your photo stays in this browser and is never uploaded.
Does this solve differently sized sliding blocks?
This tool solves the single-gap square or rectangular grid with equal-sized tiles. Puzzles with different-sized blocks, such as Klotski or traffic-jam puzzles, have different movement rules and are not supported by this solver.
Why does a large puzzle reach the search limit?
Proving a route is shortest can require exploring many arrangements. Searches have time and storage limits, including an approximately eight-second search budget. If Shortest solution reaches the limit, try Fast solution, which places tiles in stages instead of proving a global minimum.
Do I need an account?
No account, payment or download is required. The search runs in a background worker in your browser. Reloading clears your board and photo, so keep a copy of a layout you want to return to.