Sliding Puzzle
Slide the tiles back into order. Sixty boards from 3×3 to 5×5 — and two things no other sliding puzzle site will give you: the true minimum number of moves for the board in front of you, and a checker that tells you whether an arrangement can be solved at all, showing the arithmetic it used.
Also called the 15 puzzle, sliding tile puzzle, slide puzzle, 8 puzzle and mystic square.
What A Sliding Puzzle Is
A sliding puzzle is a grid of numbered tiles with one slot left empty. Any tile next to the empty slot can slide into it, and that is the only legal move — nothing is ever lifted out. Your job is to get the tiles back into order. The name changes with the size: a 3×3 board is the 8 puzzle, a 4×4 is the 15 puzzle, and a 5×5 is the 24 puzzle, each named for how many tiles it holds.
What makes it a genuine puzzle rather than a chore is that the empty slot is the only thing you really control. You never move a tile where you want it directly; you move the gap around the board and let it carry tiles with it. Beginners try to drag a tile towards its home and find they have thrown three others out of place. The whole skill is learning to think in terms of where the gap has to travel.
The Three Sizes, And What Changes Between Them
The rules are identical at every size. What changes is how much of the board you can hold in your head at once — and how quickly the arithmetic runs away from you.
| Board | Name | Tiles | Solvable arrangements | Hardest board |
|---|---|---|---|---|
| 3×3 | 8 puzzle | 8 | 181,440 | 31 moves |
| 4×4 | 15 puzzle | 15 | ≈10.46 trillion | 80 moves |
| 5×5 | 24 puzzle | 24 | ≈7.8 × 1024 | not known |
The 3×3 figures on this page are not quoted from anywhere — they are computed. The site searches the entire 3×3 space every time its test suite runs, reaches exactly 181,440 arrangements, and finds the furthest at 31 moves. The 4×4 diameter of 80 is an established result. The 5×5 has never been searched exhaustively, and anyone who gives you a number for it is guessing.
Half Of All Arrangements Are Impossible
This is the fact every sliding puzzle site mentions and none of them lets you test. If you prise the tiles out of a physical puzzle and drop them back in at random, there is a 50% chance the puzzle you have just made cannot be solved — not by you, not by anyone, not by a computer, not ever.
The reason is short enough to state completely. Every slide swaps the gap with exactly one neighbouring tile. A swap of two things flips the parity of the arrangement — whether it takes an even or odd number of swaps to sort it. At the same time, the gap moves one step. So both quantities flip on every single move, together, forever. Their combination is fixed from the moment the tiles are laid out, and if it does not match the finished board, no sequence of moves will ever bridge the gap.
How To Check It By Hand
Read the board left to right, top to bottom, ignoring the gap. Count the inversions: every pair of tiles where a larger number comes before a smaller one. Then:
| Board size | Test | Why the difference |
|---|---|---|
| Odd (3×3, 5×5) | Solvable when inversions are even | A vertical slide jumps a tile past an even number of others, so the gap's row cannot matter |
| Even (4×4) | Solvable when inversions + the gap's row from the bottom is odd | A vertical slide jumps a tile past an odd number of others, so the gap's row has to join the sum |
The classic demonstration is the 14-15 puzzle: a finished board with only those two tiles swapped. One swap flips the parity, so the board is impossible. Sam Loyd offered $1,000 for a solution and never had to pay, which tells you he knew.
Use the Solvable or not boards above to practise the count. You are shown an arrangement, you decide, and then the board tells you the answer and the numbers behind it — the inversion count, the gap row, and the sum. Half of them are impossible, and they are chosen by making a solvable board and swapping two tiles, which is precisely the move that flips parity.
How To Solve A Sliding Puzzle: The Layer Method
There is a method that always works and never asks you to plan more than a few moves ahead. It does not produce the shortest solution — it usually takes two or three times the minimum — but it is reliable, and reliability is worth more than elegance when you are stuck.
- Finish the top row, left to right. Place the first tiles one at a time. Once a tile is home, avoid disturbing it.
- Place the last two tiles of the row together. This is the step that defeats people. The final two tiles of a row cannot be placed one after the other — putting the second one in kicks the first one out. Instead, put the last tile of the row into the corner, put the second-to-last directly beneath it, and then rotate the pair in as a unit.
- Do the same down the left column. Same trick for its final two tiles.
- Repeat on what remains. With the top row and left column finished and untouched, you are looking at a board one size smaller. Keep going.
- Cycle the last three. When a 2×2 corner is left, the three tiles in it can only rotate around the gap. Keep cycling in one direction and they fall in. If they cycle forever without landing, the board was one of the impossible half — and that is the moment people discover they skipped step zero.
Use the practise the top row and last two rows boards to drill the two steps that actually cost time, rather than replaying the easy opening over and over.
The Shortest Solution, And Why Nobody Else Shows It
Solving a board is one thing; solving it in the fewest possible moves is another entirely. Finding the true minimum for a generalised n-puzzle is NP-hard, and the standard approach for the 4×4 is IDA* search guided by a Manhattan-distance heuristic with linear-conflict corrections. That is why a typical sliding puzzle site says something like "the optimal solution is a hard computational problem" and moves on.
For a 3×3 it is not hard at all, because the whole space is small. There are only 181,440 solvable arrangements, so a breadth-first search from your board reaches the finish and reports the exact number of moves — not an estimate, not a heuristic, the genuine minimum. This page runs that search:
- Every 3×3 board gets its exact minimum, always.
- Shallow 4×4 boards get theirs too — the Beat the minimum boards are chosen to stay inside what can honestly be computed in a browser tab.
- Deep 4×4 and 5×5 boards do not. The page says so plainly rather than inventing a number. A guess dressed up as an answer would be worse than no answer.
Two features come out of that search. Best next move gives you a first move of a shortest solution, and tells you how many moves remain if you play perfectly from there. Show shortest solution gives the entire sequence. And when you finish a board that had a known minimum, you are told how many moves you wasted — which is a far better measure of improvement than the clock.
Where The Puzzle Came From
The 15 puzzle is credited to Noyes Palmer Chapman, a postmaster in Canastota, New York, around 1874. Sam Loyd, the American puzzle writer, later claimed to have invented it and promoted the impossible 14-15 arrangement with a $1,000 prize. Puzzle historians do not accept his claim, but his promotion is what turned it into the craze of 1880 — an early example of a puzzle going viral on the strength of a problem that could not be solved.
The mathematics arrived quickly. Johnson and Story published the parity argument in 1879, showing that exactly half of all starting positions are unreachable. It is one of the neatest impossibility proofs in recreational mathematics: it needs no computation, only the observation that two things flip together on every move.
Other Names And Variants You Will See
| Name | What it means |
|---|---|
| 15 puzzle | The 4×4 board. The default meaning of "sliding puzzle". |
| 8 puzzle | The 3×3 board. Standard in computer science as a search problem. |
| 24 puzzle | The 5×5 board. |
| Mystic square | A period name for the same 4×4 puzzle. |
| Slide puzzle / sliding tile puzzle | The same thing, described rather than named. |
| Picture sliding puzzle | Tiles carry pieces of an image instead of numbers. Identical mechanics, harder to read — play that version here. |
Common Mistakes
- Chasing a tile directly. You move the gap, not the tile. Plan the gap's route.
- Solving the last two tiles of a row one at a time. It cannot be done. Rotate them in as a pair.
- Disturbing finished rows. Once the top row is done it is a wall. If you have to break it, you have gone wrong earlier.
- Not checking solvability first on a physical puzzle whose tiles have been out. Ten minutes of pushing tiles is a long time to spend on something impossible.
- Treating the 4×4 rule as universal. The gap's row only matters on even boards. On a 3×3 or 5×5 the inversion count alone decides.
Sliding Puzzle Frequently Asked Questions
Are all 15 puzzle arrangements solvable?
No — exactly half are impossible. Johnson and Story proved it in 1879. Every slide flips both the arrangement's parity and the gap's position together, so a board whose parity does not match the finished one can never reach it. Use the solvability boards above to test any arrangement and see the working.
How do you know if a sliding puzzle is unsolvable?
Count the inversions — pairs of tiles in the wrong order reading left to right, top to bottom, ignoring the gap. On a 3×3 or 5×5, solvable means an even count. On a 4×4, add the gap's row counted from the bottom and the total must be odd. The 14-15 puzzle fails this, which is why it was never winnable.
What is the minimum number of moves to solve a 15 puzzle?
It depends on the board. The worst possible 15 puzzle is 80 moves from finished and a typical scramble is 40–80; for a 3×3 the worst case is 31. Finding the true minimum in general is NP-hard, which is why most sites will not tell you. This page computes it exactly for every 3×3 board and for the shallow 4×4 boards, and says so honestly when a board is too deep to search.
What is the fastest way to solve a sliding puzzle?
The layer method: top row, then left column, each becoming a wall, until a 2×2 corner is left to cycle. It is not the shortest route — usually two or three times the minimum — but it always works and never needs deep planning.
Who invented the 15 puzzle?
Noyes Palmer Chapman, around 1874. Sam Loyd claimed it later and offered $1,000 for the impossible 14-15 arrangement, which historians treat as promotion rather than invention — though the promotion is what caused the 1880 craze.
Is the sliding puzzle good for your brain?
It genuinely trains planning and spatial working memory, because you have to hold a sequence of moves in mind and see several steps ahead. It will make you better at sliding puzzles and at planning under constraint. Anything broader than that is a claim we are not going to make for you.
Can I play on a phone?
Yes — tap any tile beside the gap. On a keyboard the arrow keys move the gap, so the tile travels the opposite way, matching how a physical puzzle behaves. No app, no account.
What sizes of sliding puzzle can you play?
Three: 3×3 (the 8 puzzle), 4×4 (the 15 puzzle) and 5×5 (the 24 puzzle). All sixty boards on this page are drawn from those three sizes, with three different finished arrangements — reading order, column order and a spiral — and scramble depths from three moves to more than two hundred.
How do you solve the last row of a sliding puzzle?
The last two rows have to be solved together, not one at a time — and that is what traps most people. Place the final two tiles of a row as a pair: put them in the two cells above where they belong, then rotate them down together. Solving the bottom row left to right seems obvious and then leaves the last two tiles swapped with no legal way to fix them.