Puzzles Guides About Contact All puzzles →
All guides
Method Sliding Puzzle 8 min read

A method for the sliding puzzle

Almost everyone can solve the first two rows of a fifteen puzzle by shuffling tiles about. The method below is what gets you the rest, and it is four ideas rather than a memorised algorithm.

Level Method Puzzle Sliding Puzzle About 8 minutes

Solve it in layers, never all at once

The mistake that makes this puzzle feel impossible is trying to improve the whole board at the same time. Every tile you move disturbs another, so global progress goes round in circles.

Instead, finish regions and never touch them again. The order is: the top row, then the leftmost column, then repeat on what is left.

Top row and left column done

The puzzle that remains

Once the top row and left column are finished, the rest of the board is a three by three sliding puzzle. Solve its top row and left column and you are down to a two by two, which is a handful of moves.

This is the whole strategy. A four by four becomes a three by three becomes a two by two. Each stage is easier than the last, and nothing you finish ever needs to move again.

Moving one tile without wrecking the rest

To bring a tile somewhere, you do not move the tile. You move the gap, walking it around the board until it sits next to the tile on the side you want the tile to travel towards, then slide the tile into it.

The gap will disturb whatever it walks through, so route it deliberately:

  1. Never walk the gap through finished territory. Go the long way round, below or to the right of what you have already solved.
  2. Move the target tile along a row or column, not diagonally. There is no diagonal move; a diagonal step is really two moves and it is easy to lose track.
  3. Bring the tile to its column first, then up its column. Or the reverse. Picking one order and sticking to it makes the routes predictable.

Counting moves is worth doing while you learn. Our board keeps a running count and remembers your best per size, which is a fair measure of how tidy your gap routing has become.

The last two tiles of a row

Here is the position that stops people. Three tiles of the top row are placed, and the last two — say 3 and 4 — will not both go in. Put 3 in its place and 4 is in the way; fix 4 and 3 pops out.

The answer is to stop trying to place them where they belong. Place them rotated instead:

Set it up like this

One rotation later

Put the 3 in the corner where the 4 belongs, and the 4 directly beneath it. Now bring the gap into the square to the left of the 3 and rotate the pair anticlockwise: the 3 slides left into place and the 4 comes up behind it. Both land correctly in a handful of moves.

The same trick finishes the last two tiles of a column, turned ninety degrees: put the upper tile in the bottom position and the other one to its right, then rotate. Once you have done each of them twice they stop needing to be looked up.

The three-tile rotation

Underneath the trick above is the one manoeuvre worth genuinely learning. With the gap in a corner of a two by two area, walking it around that little square cycles the three tiles in it and leaves everything outside untouched.

Walk the gap around a two by two block and the three tiles inside rotate one position. Go around the other way and they rotate back. Nothing outside the block moves at all, which is what makes it safe near finished work.

That is your precision tool. Whenever two tiles are almost right and swapping them would fix everything, the answer is a rotation in a two by two block, not a long journey across the board. It is also the reason the last-two trick works: setting the pair up rotated means one cycle puts both home.

The final two by two

When only a two by two corner is left, there are three tiles and a gap, and the only thing you can do is rotate them. So either they come out in order within three rotations, or they never will.

If they will not, you have made an error earlier — almost always a tile placed in the wrong row during the layer stage. On a board shuffled from the solved state this ending is always reachable, so it is worth undoing rather than restarting.

Why our boards always have an answer

Exactly half of all arrangements of a fifteen puzzle cannot be reached from the solved state, and no amount of skill will solve one. Rather than shuffling the tiles randomly and hoping, we start from the finished board and make a long run of legal moves. Whatever comes out can always be walked back, because you can simply reverse the moves that made it.

Three by three, four by four, five by five

The three by three is a good place to practise the rotation, because the whole puzzle is a top row and then a two by two. The four by four is the classic. The five by five is the same method with two extra layers and roughly four times the moves.

On the larger boards, the layer order matters more. Finish the top row and the left column as a pair, working inwards, rather than completing an entire row first — a finished full row leaves the remaining region awkwardly shaped and the gap has fewer safe routes.

If you want a number to chase: a well-routed four by four from a thorough shuffle takes most people somewhere between eighty and a hundred and forty moves. The theoretical worst case is eighty, and getting near that requires planning several tiles ahead rather than the layer method.

Try the layer method

Start on three by three to get the rotation into your hands, then move up. Arrow keys slide, and the helper highlights tiles that are already home.

Open a board