Slide puzzle solver: solve any 3x3 or 4x4 sliding puzzle step by step
🧩 Slide Puzzle Solver — Enter Your Tiles, Get Every Move

Type the tiles of your 3×3 or 4×4 sliding puzzle (0 for the empty space) or shuffle a new one, then press Solve. The solver checks if the puzzle can be solved and shows each move step by step. You can also play it yourself.

📑 In this guide (6 sections)
  1. How Does a Slide Puzzle Solver Work?
  2. How Do You Use the Slide Puzzle Solver?
  3. How Do You Solve a Slide Puzzle by Hand?
  4. Why Can't Some Sliding Puzzles Be Solved?
  5. What Are 3×3 and 4×4 Sliding Puzzles Called?
  6. FAQs

A slide puzzle solver takes the current layout of a sliding tile puzzle and returns the list of moves that puts every tile back in order. Type your tiles into the solver above (use 0 for the empty space), press Solve, and step through each move; for 3×3 boards it always finds the shortest possible solution.

I wrote this tool after a student brought in a cheap plastic 15 puzzle that had been "fixed" by prying two tiles out and pushing them back in the wrong spots. No amount of sliding could finish it, and nobody knew why. The solver above checks that first, then solves, so you never waste an afternoon on a board that cannot be done.

Below you will learn how a sliding puzzle solver works, how to solve a slide puzzle by hand, why some boards are impossible, and quick answers to common questions. Under the hood it uses A* search with the Manhattan distance heuristic, the same optimal approach many BFS and IDA* tools build on, and it detects a board with two tiles swapped before it starts.

How Does a Slide Puzzle Solver Work?

A slide puzzle solver works by searching through possible moves from your starting layout until it reaches the goal, using a scoring rule that estimates how far each layout is from solved, so it checks the most promising moves first.

The search method in our tool is called A* (A-star). For every board it adds the moves made so far to an estimate of the moves still needed. That estimate is the Manhattan distance, the number of rows plus columns each tile sits away from its home, with a small bonus for tiles that block each other in the same row or column. Because the estimate never guesses too high, the first solution A* finds on a 3×3 board is the shortest one.

Other solvers use breadth-first search (BFS), which tries every board one move away, then two moves away, and so on. BFS also gives the shortest path, but it is slower because it does not aim. A variant called IDA* uses far less memory on big boards. A few tools add a human-style strategic mode that solves row by row, which is longer but easier to follow. In plain terms, the tool can solve automatically and restore the order step by step on any grid size it supports, and on 4×4 it may return a path that is not always the shortest but is always valid. The same idea works whether you solve row by row or column by column.

How Do You Use the Slide Puzzle Solver?

You use the slide puzzle solver by choosing 3×3 or 4×4, typing your tiles row by row with 0 for the gap, pressing Load tiles and then Solve. The tool lists every move as the number of the tile to slide.

  1. Pick the size: 3×3 is the 8 puzzle, 4×4 is the 15 puzzle.
  2. Enter the tiles from the top-left corner, left to right, one row after another, for example 1 2 3 4 0 6 7 5 8.
  3. Press Load tiles and check the board matches your real puzzle.
  4. Press Solve and read the move count.
  5. Step through with Next move, or press Play all to watch every slide.

The tile to move next glows orange, so you can copy each move on your own puzzle. If you prefer to practice, press Shuffle and click tiles next to the gap yourself; the move counter shows how close you get to the solver's number. Unlike some tools, there is no need to drag pieces into place: typing is faster. The A* search uses its heuristic rather than a slower strategic row-by-row mode, and on most boards it answers in about a second. A 3×2 cycle near the end is the pattern you will copy most often, and on a fresh shuffle about half of all tiles start outside their home rows.

Slide puzzle solver with a 3x3 board loaded from typed tiles
Type your tiles row by row, with 0 for the empty space.

How Do You Solve a Slide Puzzle by Hand?

You solve a slide puzzle by hand by finishing the top row first, then the left column, and shrinking the puzzle until only a 2×3 or 3×2 area remains, which you finish by rotating the last tiles around the gap.

The top row is the easy part until the last two tiles. On a 3×3 board, place 1 and 2 normally, then park 3 under its home spot and swing it into the corner in one move. That tucking trick is the slide puzzle strategy most beginners are missing. On a 4×4 board, do the same with tiles 3 and 4, then repeat the idea for the left column.

Once a row and a column are locked, never move them again, and the board behaves like a smaller one. Finish the last three tiles by cycling them clockwise or counterclockwise around the empty space. In my experience, people who learn this routine can solve any 3×3 board in under two minutes, even if their move count is double the solver's. The solver can help here too: enter the numbers 1 to 8 with one blank and no duplicates, press Solve, then use Back (the previous move) and Clear the board when you want to start over. Compare your manual routine with its inversions check and its move list, and note which steps you could cut.

Why Can't Some Sliding Puzzles Be Solved?

Some sliding puzzles cannot be solved because exactly half of all possible tile layouts are unreachable by sliding, usually because two tiles have been swapped by hand. No sequence of legal moves can fix a single swap.

The test uses inversions: count every pair of tiles where a larger number comes before a smaller one when you read the board row by row, ignoring the gap. On a 3×3 board, the puzzle is solvable when that count is even. On a 4×4 board, you also count which row the gap sits in from the bottom, and the puzzle is solvable when the inversions plus that row number is odd.

The solver above runs this check before searching, and the status line shows Solvable or Not solvable as soon as you load a board. If yours is not solvable, swap any two numbered tiles and it will be. That is exactly what happened with my student's 15 puzzle. Picture puzzles have the same rule: a screenshot of a scrambled picture board can still be impossible if two pieces were swapped. Some online tools accept boards from 3×3 to 8×8, others up to 25×25, with a custom image or hollow variants, and they all run this check first.

Slide puzzle solver showing the solution moves step by step
The next tile to slide glows orange in the move list.

What Are 3×3 and 4×4 Sliding Puzzles Called?

A 3×3 sliding puzzle is called the 8 puzzle because it has eight numbered tiles and one gap, and a 4×4 sliding puzzle is called the 15 puzzle because it has fifteen tiles and one gap.

Both are sliding block puzzles, part of a wider family that includes picture puzzles, where an image is cut into squares, and larger boards such as 5×5 and beyond. The rules never change: only a tile next to the gap can move, and it moves into the gap. Picture versions are harder for many people, because there are no numbers to tell you where a piece belongs.

Board Tiles Name Our solver
3×3 8 + gap 8 puzzle Always the shortest solution
4×4 15 + gap 15 puzzle Shortest when found quickly, otherwise a short path

Hard 4×4 boards can need dozens of moves, and proving the very shortest path takes a lot of computing, so the tool switches to a faster search on those and says so in the result. For scale, the 8 puzzle never needs more than 31 moves and the 15 puzzle never needs more than 80 moves, so a long answer is not a sign that something went wrong. Our solver, IDA* tools and BFS tools all trade speed against memory, and most random boards land well below those limits. Tuck the last tile of each row, keep finished rows locked, shrink the board, then cycle; many guides teach exactly this routine. Many apps also let you drag tiles instead of clicking them.

4x4 15 puzzle in the slide puzzle solver, full screen
The 4×4 mode solves the classic 15 puzzle.

Slide Puzzle Solver FAQs

Is the Solution Always the Shortest?

The solution is always the shortest on 3×3 boards, and usually the shortest on 4×4 boards. When a 4×4 board would take too long to prove, the solver returns a short path instead and labels it as not always the shortest. Either way, every listed move is legal and ends at the solved board. There are often other possible solutions of the same length, so your path may differ from a friend's. A swapped pair of adjacent tiles is the usual reason a board fails, and the tool tells you at once.

How Many Moves Does It Take to Solve a 3×3 Slide Puzzle?

Any solvable 3×3 slide puzzle can be finished in 31 moves or fewer, and most random boards need about 20 to 26. Shuffle a few boards above and you will see the move counts land in that range. A 4×4 board can need up to 80 moves. Some apps let you upload a target picture or set a custom goal state, but the classic goal is the numbers in order with the gap in the bottom-right corner.

Can I Use the Solver for a Picture Slide Puzzle?

Yes, you can use the solver for a picture slide puzzle by numbering the pieces first. Call the piece that belongs in the top-left corner 1, the next one 2, and so on, with 0 for the gap, then type those numbers in. For more tile practice, play the 4x4 number puzzle game then try the 3D puzzle game. As with numbered boards, there may be other possible solutions of the same length.


Muhammad Hammad

Muhammad Hammad is the founder and editor of Cool Math Game Puzzle. He creates and reviews the site's logic puzzles, number puzzles and sudoku guides for students, teachers, parents and puzzle fans.