How to solve a sliding puzzle
By Arnaud, creator of procstd. Updated November 22, 2026.
A sliding puzzle (the 8-puzzle or 15-puzzle) is always solved with the same method: you tidy the grid piece by piece, row by row, never touching what is already in place. The only hard part is the end of each row, where the last two tiles go in together thanks to a small trick. Here is the full method, the trick in pictures, and the rule that tells at a glance whether a puzzle can be solved.
Try it as you read: play Slide Puzzle, free and ad-free.
The rules
Numbered tiles are shuffled in a frame, with a single empty square. You slide a tile that touches the empty square into it, from above, below, the left or the right. The goal: put the tiles in order, row by row, from 1 at the top left to the last one, with the empty square at the bottom right.
In the Slide Puzzle game, each grid is made by shuffling a solved grid with real slides: it always has a solution. The leaderboard counts time, not the number of moves.
The method: tidy piece by piece
Start with the top row: tiles 1, 2 and 3 on a 3 × 3 puzzle. Once it is done, leave it alone: what remains is a puzzle of 2 rows. Then tidy the left column (4 and 7): only a 2 × 2 square is left, which you simply turn until the last three tiles are in place.
To bring a tile to its square, move the empty square around it: each time the empty square passes in front of the tile, on the side it must go, the tile moves one square forward. The empty square is your cursor; the tile follows. Turn the empty square around the tile, never through the part already done.
The first tiles of a row go in one at a time, easily. The last two are the problem: once the second-to-last is placed, the last one cannot get in without pushing it out.
The trick for the last two tiles of a row
Put the last tile of the row where the second-to-last belongs, and the second-to-last just below it. Bring the empty square to the corner, at the end of the row. Only two moves are left: the last tile slides into the corner, and the second-to-last moves up behind it.
On a 3 × 3 puzzle, for the top row: 3 where 2 belongs, 2 below 3, the empty square at the top right. 3 slides right, 2 moves up: the row 1 2 3 is done.
3 slides right, then 2 moves up: two moves, and the top row is done.
The same trick for a column
When only two rows are left, tidy them column by column, left to right, with the same trick turned a quarter turn. For the left column of a 3 × 3 puzzle: 7 where 4 belongs, 4 to its right, the empty square at the bottom left. 7 slides down, 4 slides left.
A 2 × 2 square with three tiles is then left: turn the empty square around it, always the same way, until everything is in place. Either way, it always gets there, in twelve moves at most; pick the shorter way.
7 slides down, then 4 slides left: the left column is done, and only a 2 × 2 square is left to turn.
4 × 4 and 5 × 5 puzzles
The method does not change: tidy the top row, then the next, until only two rows are left. Then tidy those two rows column by column, left to right, and finish with the 2 × 2 square. A 4 × 4 puzzle is just a 3 × 3 one with an extra row and column in front; a 5 × 5, a 4 × 4 with an extra row and column.
On large grids, the last-two-tiles trick is used for every row and every column: it is what saves the most time once you have it down.
Why some puzzles are impossible
Read the tiles in order, row by row, leaving out the empty square, and count the "inversions": every pair of tiles where the larger comes before the smaller. On a grid of odd width (3 × 3, 5 × 5), the puzzle can be solved if that number is even. On a grid of even width (4 × 4), add the number of the empty square's row, counting 1 for the bottom row: the puzzle can be solved if the total is odd.
Swapping two tiles changes the parity: a puzzle where two tiles were taken out and put back the wrong way round becomes impossible. That is Sam Loyd's famous challenge, in the late 19th century: a solved 4 × 4 puzzle, except 14 and 15 swapped. Nobody ever won the prize, because it cannot be done. In the game, this never happens.
Going faster
Look at where the next tile must go before moving, and plan the empty square's path to reach it from the right side. Avoid back-and-forth: each one undoes the move before. And don't look for the absolute shortest path: the piece-by-piece method is not the shortest in moves, but it can be played without long thinking, and time is what counts.
The game's levels
Easy: 3 × 3, lightly shuffled. Hard, the leaderboard level: 3 × 3, well shuffled. Expert: 4 × 4. Hardcore: 5 × 5, 24 tiles.
Your turn
The rules, the levels and the frequently asked questions are on the Slide Puzzle page. Each level has its own leaderboard.
Play Slide PuzzleOther guides
- How to solve a sudoku: the techniques that work
- Minesweeper: the patterns to know
- How to win at Solitaire: the strategy
- Wordle-style game in French: how to find the word
- 2048: the strategy to win
- How to win at FreeCell
- Nonograms and picross: the method to solve them
- Takuzu (binary puzzle): the techniques to solve it
- How to win at Spider Solitaire
- Killer sudoku: cage combinations and the rule of 45
- Kakuro: sum combinations and the method
- How to solve a Hitori
- Einstein's Riddle: the grid method
- Mahjong solitaire: which tiles to remove first
- How to solve a Slitherlink
- Masyu: the basic techniques
- Traffic Jam: getting the red car out
- Sokoban: the mistakes to avoid
- The 11 nets of a cube
- The Tower of Hanoi: solution and method
- The knight's tour: the method and the solution
- Calcudoku: how to solve a grid
- The fake coin puzzle: the method and the 12 coins solution
- How to win at Reversi: the three rules of strategy
- How to win at Four in a Row: the four rules
- How to solve a Skyscrapers puzzle: reading the clues
- How to solve a Tents puzzle: the method
- Yatzy strategy: which dice to keep and where to score
- Solo Battleships puzzle: the method to find the fleet
- How to solve a Crowns puzzle: the method
- Secret Code: the strategy to crack it in 4 or 5 guesses
- How to solve a Bridges (Hashi) puzzle: the method
- How to solve a Light Up (Akari) puzzle: the method
- How to solve an Islands (Nurikabe) puzzle: the method
- How to solve a Suguru: the method
- How to solve a Mosaic puzzle: the method
- How to solve a Rectangles (Shikaku) puzzle: the method
- How to solve a Dominoes (Dominosa) puzzle: the method
- How to solve a Thermometers puzzle: the method
- How to solve an Inequalities (Futoshiki) puzzle: the method
- How to solve an Aquarium puzzle: the method
- How to win at Oware: the four reflexes