15 puzzle

15 puzzle online

Slide the numbered wooden tiles back into order, 1 to 15, with the gap in the corner. Choose 3×3, 4×4 or 5×5; every shuffle is guaranteed solvable. Free, no sign-up, made for touch. Want a different kind of slider? Try klotski.

15 puzzle 4×4

Moves0Time0:00Best—

Tap a tile next to the gap, or a tile in the same row or column to slide the whole line. You can also swipe on the board. 15/15 in place

How to play the 15 puzzle

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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

Only 14 and 15 swapped: impossible

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.
One of the two hardest 3×3 boards (31 moves)

How many 3×3 positions are exactly a given number of moves from solved (our breadth-first search over every position):

Fewest movesPositionsFewest movesPositions
01164,485
12175,638
24189,529
381910,878
4162016,993
5202117,110
6392223,952
7622320,224
81162424,047
91522515,578
102862614,560
11396276,274
12748283,910
131,02429760
141,89330221
152,512312

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.

FAQ

Is every shuffle solvable?

Yes. Exactly half of all arrangements of the tiles can be solved and the other half cannot. We shuffle by picking a random arrangement and, if it falls in the unsolvable half, swapping two tiles, which always moves it to the solvable half. So every board you get can be finished.

How do I know if a 15 puzzle can be solved?

Count inversions: pairs of tiles where a bigger number comes before a smaller one when you read the board row by row, ignoring the gap. On a board with an odd width (3×3, 5×5) the puzzle is solvable when the inversions are even. On a 4×4 board, add the row of the gap counted from the bottom (bottom row = 1); the puzzle is solvable when that total is odd.

What is the fewest number of moves to solve the 15 puzzle?

It depends on the shuffle. For the 3×3 version our search of all 181,440 solvable positions shows that every one can be solved in 31 moves or fewer, and the average is 21.97. For the 4×4 board, computer searches published by researchers have shown that no position needs more than 80 single-tile moves.

How are moves counted here?

One tile moved one square is one move. If you slide a whole line of three tiles with one tap, that counts as three moves, the same way the minimum numbers above are counted.

What is the difference between the 15 puzzle and klotski?

In the 15 puzzle every tile is the same 1×1 size and the goal is to sort the numbers. In klotski the blocks have different sizes and the goal is to move one big block to an exit. Both are sliding puzzles but the thinking is different.

Does it work on a phone or iPad?

Yes. Tiles are big enough for fingers, a tap moves a whole line, and swipes work anywhere on the board. Your current game, timer and best scores are kept in your browser, no sign-up needed.