How to play the 15 puzzle
- Pick a board size. 3×3 (8 tiles) is a quick warm-up, 4×4 is the classic 15 puzzle and 5×5 (24 tiles) is a long challenge. Each size keeps its own game and best score.
- Slide tiles into the gap. Tap a tile next to the empty square to slide it in. Tap a tile further along the same row or column and the whole line slides at once. You can also swipe on the board or use the arrow keys.
- Put the numbers in order. Fill the board left to right, top to bottom: 1, 2, 3… with the empty square in the bottom-right corner. Tiles already in their home square turn green.
- Watch the clock and the counter. The timer starts with your first move and stops when the board is solved. Every tile moved counts as one move. Your fewest moves and fastest time are saved on this device.
- Undo, shuffle or ask for a hint. Undo takes back moves, Shuffle deals a new solvable board and Hint plays the next move of a solution from your current position. A game solved with hints does not count as a best.
How to solve the 15 puzzle: a method that always works
You do not need to memorise algorithms. Solve the board in layers so that finished tiles never have to move again:
- Top row first. Bring 1 home, then 2. Move the gap around a tile to “walk” it: the gap goes in front of the tile, the tile steps into it, repeat.
- Last two tiles of a row go in together. 3 and 4 cannot be placed one after the other. Park 4 in the corner where 3 belongs, put 3 directly under it, then move the gap so both slide in with one turn.
- Repeat for the second row. On 4×4 the board is now a 4×2 strip; on 5×5 keep going row by row until two rows are left.
- Finish the last two rows column by column. Pair the tiles that share a column (9 with 13, then 10 with 14 on 4×4) and use the same “park one, slot the other” trick sideways.
- The last 2×2 square solves itself: cycle the three remaining tiles around the gap until they drop into place.
Hints in this game follow the same layer idea, so if you press Hint a few times you can watch the method in action. On 3×3 the hint is always a shortest route.
Why half of all shuffles can’t be solved
Every slide swaps the gap with a tile. That changes the order of the numbers in a very controlled way, so a hidden “parity” is preserved no matter how you play. The board on the left looks one swap away from solved, but no sequence of slides can fix it.
- Odd width (3×3, 5×5): count inversions, the pairs where a bigger number is read before a smaller one. Solvable exactly when the count is even.
- Even width (4×4): add the gap’s row counted from the bottom. Solvable exactly when the total is odd.
We checked this rule against a full search: of the 362,880 ways to arrange the 3×3 board, exactly 181,440 can be reached from the solved position, and the rule picks out the same ones. Our shuffle uses it to make sure you never get a dead board.
How many moves does it take? Numbers for each size
- 3×3 (8 puzzle): 181,440 solvable positions. Every one can be solved in at most 31 moves; the average is 21.97. Only 2 positions need all 31.
- 4×4 (15 puzzle): 10,461,394,944,000 solvable positions — too many to list, but published computer searches have shown that none needs more than 80 moves.
- 5×5 (24 puzzle): about 7.76 × 1024 solvable positions. Expect a few hundred moves on your first solve with the layer method.
How many 3×3 positions are exactly a given number of moves from solved (our breadth-first search over every position):
| Fewest moves | Positions | Fewest moves | Positions |
|---|---|---|---|
| 0 | 1 | 16 | 4,485 |
| 1 | 2 | 17 | 5,638 |
| 2 | 4 | 18 | 9,529 |
| 3 | 8 | 19 | 10,878 |
| 4 | 16 | 20 | 16,993 |
| 5 | 20 | 21 | 17,110 |
| 6 | 39 | 22 | 23,952 |
| 7 | 62 | 23 | 20,224 |
| 8 | 116 | 24 | 24,047 |
| 9 | 152 | 25 | 15,578 |
| 10 | 286 | 26 | 14,560 |
| 11 | 396 | 27 | 6,274 |
| 12 | 748 | 28 | 3,910 |
| 13 | 1,024 | 29 | 760 |
| 14 | 1,893 | 30 | 221 |
| 15 | 2,512 | 31 | 2 |
15 puzzle, klotski and other sliding puzzles
The 15 puzzle is the best-known sliding tile puzzle: identical square tiles, one gap, and the challenge is sorting. In Chinese it is often called 数字华容道 (“number Huarong Dao”); you can play the Chinese version of this page with the same saved games.
Exit puzzles work differently: blocks of different sizes, and you must make room for one big block to escape. Try the classic 4×5 klotski (and its 81-move solution), our sliding block puzzle levels, or 华容道. For packing rather than sliding, the wood block puzzle is a good next stop.