Sliding Puzzle Solver

Set up any 8-puzzle or 15-puzzle by sliding the tiles — or scramble one — then watch the solver play out the solution, step by step. Everything runs in your browser, nothing is uploaded.

How to Use the Solver

Choose 3×3 or 4×4, then build the puzzle you're stuck on: click any tile next to the empty gap to slide it, and keep going until the board matches yours. Prefer a random one? Hit Scramble. Then press Solve and the tiles slide themselves into order, one move at a time, with a running move count. Reset returns to the solved board. Because you build the puzzle by sliding real tiles, it's always solvable.

How the Solver Works

The solver searches with IDA* — iterative-deepening A* — guided by two classic admissible heuristics: Manhattan distance (how far each tile is from home) plus linear conflict (extra moves when two tiles in their goal row or column are reversed). For the 3×3 that finds a provably shortest solution instantly. The 15-puzzle's search space is astronomically larger, so there the solver uses a lightly-weighted search that returns a fast, near-shortest solution rather than grinding for the absolute minimum — keeping it instant in your browser. Nothing leaves your device.

Frequently Asked Questions

How do I set up my puzzle?
Slide tiles by clicking any tile next to the empty space — build the exact arrangement you're stuck on. Or press Scramble for a random puzzle. Because you build it by sliding, the position is always solvable.
What sizes does it solve?
The sliding puzzle solver handles the 3×3 eight-puzzle and the 4×4 fifteen-puzzle. Switch between them with the size selector at the top of the board. Changing size resets the tiles to the solved arrangement, so pick the size before you build your position.
Does it find the shortest solution?
For the 3×3 the solver always returns the shortest possible solution. For the harder 4×4 it returns a fast, near-shortest solution instead, so the search stays instant in your browser. Every step is listed and animated, so you can follow the moves exactly on your own puzzle.
How does the solver work?
The solver searches with IDA*, iterative-deepening A*, guided by the Manhattan-distance and linear-conflict heuristics. That pair is the standard optimal method for sliding puzzles: Manhattan distance counts how far each tile sits from its home square, and linear conflict adds the extra moves needed when two tiles in the same row or column block one another. Once a solution is found, the moves are animated on the board.
Is anything uploaded?
No — nothing you set up is uploaded. The puzzle and the whole search run in your browser, so no board is sent to a server. Closing the tab clears everything.

Related Solvers & Puzzles

Want to play instead? Try the photo Sliding Puzzle. Solving other puzzles? Use the Sudoku Solver or the Minesweeper Solver, or browse all AI solvers & analyzers.

Add This Sliding Puzzle Solver to Your Website

Put the Sliding Puzzle Solver on your own page — free, no sign-up, no watermark. It runs entirely in your visitors' browsers. Copy the snippet and paste it into your page's HTML.

The credit line under the widget links back to LK Forge — please keep it so others can find it too.