5x5 Sliding Puzzle Solver
Enter your 24-tile board, check its tile order, and follow a fast solution.
The 24-tile step up
A 5x5 sliding puzzle has 24 movable tiles and one empty cell. It is often called the 24-puzzle. The extra row and column make it feel very different from a small board: a tile can belong to the right row while still blocking the route needed by another tile. Solving becomes a matter of leaving working space around the blank, rather than collecting isolated correct squares. This page opens the sliding puzzle solver at the right size, so the board you enter is the board the tool actually solves.
The usual target reads 1 through 24 across the rows, with the blank in the bottom-right corner. A different target is possible through More → Edit goal. Match your target before interpreting the answer; a route to the wrong picture or number order will not help with the puzzle in front of you.
Enter a board without losing your place
Choose Edit start, open Type numbers, and enter 25 values in row order. Use spaces or commas between values and use 0 or _ for the blank. The first five values describe the top row, the next five describe the second row, and so on. Each label from 1 to 24 must appear exactly once. The input reports missing, repeated, or out-of-range values before you can rely on the arrangement.
You can also click two cells in Edit mode to swap their contents. That is an editing shortcut, not a move you would make on a physical puzzle. For a picture, upload the completed image using Photo, then arrange its pieces to match your scramble. Piece numbers refer to the completed image from left to right and top to bottom. Do not number pieces according to where they happen to sit in the scrambled board.
How much moving should you expect?
There is no single move count for a 5x5 scramble. A board one slide away from its target needs one single-tile move; a shuffled board can require much more work. A useful lower bound is the sum of the row and column distances from each numbered tile to its target cell, leaving out the blank. Each single-tile move changes that sum by one, so a distance total of 72 means at least 72 single-tile moves are needed. It does not promise that 72 will suffice: tiles may obstruct one another and need temporary detours.
For scale, if 24 tiles are each an average of three grid steps from their targets, the distance lower bound is 72 single-tile moves. That is a worked example, not a measured average for random puzzles. The fast route shown by this tool can be longer because it favors dependable placement over an exhaustive search of complete routes. Read the displayed length as the length of the route supplied, not as a universal difficulty rating.
Three useful starting situations
A nearly completed first row is a good place to practice. Keep the blank below that row and think about placing its last two tiles together; fixing the corner too early can trap its neighbor. A board with the first row and first column already complete offers a different exercise: protect those positions and work inside the remaining square. A final 3x3 pocket is another common situation, but its pieces still carry labels from the larger board. Compare their target positions, rather than expecting the labels 1 through 8.
Avoid judging a board only by how many tiles look correct. Two displaced tiles near the end can be harder to untangle than a loosely arranged opening with plenty of room. If two tiles were swapped by hand while everything else stayed fixed, check solvability before trying repeated cycles.
Why the fast solver works in layers
For this size, the solver restores the outer row and column, then repeats inside the smaller region. It tracks a tile and the blank during placement, or a pair of tiles near a row or column end. Once a position is settled, subsequent placement searches keep the blank out of it. The remaining 3x3 region is finished with a distance table, and adjacent moves that immediately undo each other are removed from the route.
This is a constructive method: it makes steady progress without comparing every possible full-board route. Solve produces an animated answer that you can pause, step through, or replay. Follow the tile number and arrow together; the arrow describes the tile sliding into the blank, not the blank moving in the opposite direction.
Check the order before replaying
For the standard 5x5 target, ignore the blank and count inversions: pairs of numbered tiles appearing in the opposite order from the target. The count must be even. For a custom target, the tool compares your start against that actual target rather than assuming the standard order. An impossible arrangement triggers a banner with an explanation. Fix it swaps two neighboring numbered tiles to produce a reachable board, so use it only when you want to change the input. If you are copying an external puzzle, first check whether two pieces were entered in the wrong places.
Frequently asked questions
What numbers belong on a 5x5 board?
Enter every number from 1 to 24 once, plus 0 for the blank. Read across each row from left to right, starting with the top row.
Does a long answer mean my board was entered incorrectly?
Not necessarily. The solver builds a fast route by restoring rows and columns in stages. That route can contain detours even when the board is valid and solvable.