Free online 15 Puzzle
The 15 Puzzle is the classic sliding-tile game: fifteen numbers, one empty space and the goal of putting everything in order from 1 to 15. Play it free in your browser, with no clock and no rush. It looks like a matter of luck and it is a matter of method — and, as a bonus, it is one of the few puzzles where mathematics can tell you, before your first move, that a solution exists. This guide lays out the layer method with the exact moves.
History
The game is credited to Noyes Chapman, a postmaster in Canastota, New York, who is said to have shown it to friends around 1874. In 1880 it became a craze in the United States and Europe. Sam Loyd, a famous puzzle maker, claimed to have invented it, which researchers later disproved, and he became linked to the impossible "14-15" challenge, supposedly worth a $1,000 prize according to the story he himself told.
The mathematics had arrived before the craze, though: in 1879 W. W. Johnson and W. E. Story proved that half of all arrangements can never be reached by sliding.
How to play
The 4×4 grid holds tiles 1 to 15 and one empty cell. Click or tap a tile next to the gap — above, below, left or right — and it slides in. On a keyboard, the arrow keys slide a tile in the direction of the arrow: the left arrow slides the tile on the right of the gap to the left. Each tile you move adds 1 to the Moves counter. When everything is in reading order, with 1 in the top-left corner and the gap in the bottom-right, the game announces the win.
Your best score is the fewest moves you have ever needed; it is saved in the browser and only changes when you win in fewer. There is no timer and no move limit: the counter is the only scoreboard.
Rules
- A 4×4 grid with 15 tiles and one gap. The goal is 1 to 15 in reading order, with the gap in the bottom-right corner.
- Only tiles next to the gap move. Each tap moves a single tile and counts 1: shifting a row of three tiles costs three moves.
- Tapping a tile that is not next to the gap, or the gap itself, does nothing and does not count; the same goes for an arrow key with no tile to slide that way.
- The scramble starts from the solved board and makes 220 random legal moves, so every game is guaranteed to have a solution.
- There are no hints, no undo and no timer. "New Game" draws another scramble at any moment.
- The best score shows as "—" until your first win. Controls are click, tap or keyboard: the arrow keys slide a tile in the direction of the arrow, and Tab with Enter pick and move a tile next to the gap, with focus following the moved tile.
Strategies
- Think of the gap as your tool. In open space, moving a tile one cell costs 1 move if the gap is already in front of it and 5 if it is behind, because the gap must walk around the tile. Hauling tiles a long way is expensive.
- Use the sum of distances as a compass. For each tile, count how many cells are missing to its destination and add them up. A move that lowers the sum is progress; one that raises it is only worth it as part of a trick, like the corner trick.
- Close two tiles at once. The corner trick places the pair 3 and 4 (or 9 and 13) in a single manoeuvre and avoids the dead end of fitting them in one after the other.
- For a low best score, size up the board before you start. Scrambles with a low sum of distances are the easy ones. Since "New Game" costs nothing, swapping a bad board is your call.
Why every game is solvable
There are 16! possible arrangements (about 20.9 trillion), but only half of them, 10.46 trillion, can be reached by sliding; the other half is impossible. This version avoids the problem by scrambling with legal moves, so the board never leaves the reachable half.
The rule that separates the halves: count the inversions (pairs where a larger number comes before a smaller one in reading order, ignoring the gap) and add the gap's row counted from the bottom, 1 to 4. If the total is odd, the board is solvable. In the solved board, 0 + 1 = 1. Swap only the 14 and the 15 and you get 1 + 1 = 2: impossible, Sam Loyd's famous "14-15".
The layer method, step by step
Solve the board in layers, and never touch what is already done:
- 1. The top row. Place 1 and 2 with no trouble. For 3 and 4, do not try to set them in a line: bring the 4 into the 3's cell and the 3 just below it, with the gap in the top-right corner. Slide the 4 right and the 3 up, and the row closes in two moves.
- 2. The left column. Place the 5. Then bring the 13 into the 9's cell and the 9 to its right, with the gap below the 13. Slide the 13 down and the 9 left.
- 3. The 3×3 block that is left. Repeat the same trick: first the row of 6, 7 and 8, then the column of 10 and 14.
- 4. The last three. The 11, 12 and 15 and the gap form a 2×2 square. Turn the three tiles around the gap until the order closes: the parity rule guarantees that it does.
What the move counter hides
Every move takes the gap to a neighbouring cell, so the parity of the total number of moves is fixed for each board: it equals the parity of the distance, in steps, between the gap and the finishing corner. If the gap starts in the top-left corner, 6 steps from its destination, every solution, short or long, has an even number of moves. That is why the smallest possible improvement on the same board is 2 moves.
There is also a ceiling: no board needs more than 80 moves from a perfect player, a value proved by computer in 2005. And a floor: the minimum is never less than the sum, tile by tile, of the cells each one still has to travel. In simulations of this game's own scramble, that sum averages about 28, below the roughly 37 of a uniform draw among solvable boards.
Common mistakes
- Placing 1, 2, 3 and 4 in a line. The 4 only gets in if the 3 steps out of the way; that is why the corner trick exists.
- Moving at random "to see if it works out". There are 10 trillion states: without a plan, the chance of stumbling on the answer is negligible.
- Undoing your own move. Moving a tile and moving it straight back spends 2 moves and changes nothing.
- Breaking up a finished layer. Touching a solved tile usually costs many moves to rebuild.
- Assuming the game is impossible. It is not: what jams is technique, not the board.
Tips for beginners
- In your first games, ignore the counter and focus on learning the method.
- Solve the top row, then the left column, and repeat the process on the smaller square that remains.
- If you get stuck, go back one step: reorganising the current layer is cheaper than giving up.
Trivia
- The smaller 3×3 version has 181,440 reachable boards, against 10.46 trillion for the 4×4.
- The 15 Puzzle is a classic example in artificial intelligence courses for teaching heuristic search.
- This game's scramble is a random walk of 220 moves that can double back on itself, which is why difficulty varies from game to game.
Mobile version
On a phone, tap the tile next to the empty cell to slide it. The board is about 350 px wide, with tiles 76 px on a side, big enough for precise taps. There is no dragging: each tap moves one tile and counts as 1 move. The arrow keys work on a computer; on a phone the control is the tap.
Frequently asked questions
What is the goal?
To put the tiles in order from 1 to 15 by sliding them through the single empty cell, ending with the gap in the bottom-right corner.
Does every game have a solution?
Yes. The game scrambles by making 220 legal moves from the solved board, so it never produces an impossible arrangement.
What is the best technique?
Solving in layers: the top row first, then the left column, then repeat on the smaller square that remains. Closing each row or column (3 and 4; 9 and 13) takes the corner trick described above.
Can I slide several tiles at once?
No. Each tap moves a single tile next to the gap and counts 1 move; shifting three tiles in a row costs three moves.
Why can't I fit the 4 in after the 3?
Because the 3 blocks the 4's path. Instead, put the 4 in the 3's cell and the 3 just below it, with the gap in the top-right corner; slide the 4 right and the 3 up.
Is the best score a time or a number of moves?
Moves: it is the fewest you have ever needed for a win. There is no timer, and the best score is saved in the browser.
Can I ask for a hint or undo a move?
No. The only help is a new game, which draws another scramble at any moment.
Can I play with just the keyboard?
Yes. The arrow keys slide a tile in the direction of the arrow (for example, the left arrow moves the tile on the right of the gap to the left) without scrolling the page. With Tab and Enter you can also pick and move a tile next to the gap, and focus follows the moved tile.
Do I need to install anything or sign up?
No. It runs straight in your browser, free and with no sign-up.