Why 5x5 solutions aren’t the shortest
Before you press Solve, it helps to know what kind of answer a 5x5 sliding puzzle solver can give. A 5x5 board has about 7.8 septillion solvable positions, a number with 25 digits. Finding the provably shortest route through a space that size takes far more computing time than a web page can reasonably spend. Even the exact maximum number of moves a 5x5 can need is unknown: nobody knows it.
So this solver makes a different promise. It always gives you a complete, correct solution that takes your board all the way to 1–24 with the blank in the bottom-right corner, and it gives it to you fast. It does not promise that the solution is the shortest possible, and the result says “not guaranteed shortest” next to the move count, so you always know which kind of answer you have.
For a puzzle you are stuck on, that is usually the trade you want: a reliable list of moves now, rather than a perfect one that never arrives.
How the 5x5 sliding puzzle solver works, layer by layer
The solver shrinks the 24 puzzle one layer at a time, the same way a person would:
- Top row. Tiles 1 to 5 go into place. The last two tiles of the row are brought in together so the finished tiles never have to be disturbed.
- Left column. Tiles 6, 11, 16 and 21 go into place, again finishing with a pair.
- The rest is a 4x4. What remains in the bottom-right is a 4x4 puzzle. It goes to the same 4x4 solver used for the 15 puzzle, which finishes the job.
Once a tile is placed in its layer, the solver never moves it again. That is what makes the method dependable: every step makes permanent progress. It is also why the total isn’t the shortest, since the first row and column are fixed before the rest of the board is considered.
If you would like to solve a big board yourself, the same layers work by hand; how to solve a sliding puzzle shows the pair trick with diagrams.
Parity on a 5x5 board
Before solving, the tool checks whether your board can be solved at all. Exactly half of all 5x5 arrangements can’t be. Because 5 is an odd width, the rule is short: read the tiles left to right, top to bottom, skipping the blank, and count the pairs where a larger number comes before a smaller one. An even count means solvable; an odd count means impossible. Where the blank sits doesn’t matter.
Swapping any two tiles other than the blank flips the answer, so a board like the one above becomes solvable as soon as 23 and 24 trade places. Most of the time, though, an “impossible” result means a tile was entered wrong. The unsolvable sliding puzzle page explains the rule in more depth.