15 Puzzle
The classic sliding number puzzle — slide tiles into the gap and restore the order. 3×3, 4×4 and 5×5 boards, ranked scores.
How to play the 15 Puzzle
The 15 Puzzle is the world’s most famous sliding puzzle. A square frame holds numbered tiles with a single empty space, and your only move is to slide a neighbouring tile into that gap. From a scrambled start you must restore the numbers to order — 1, 2, 3 and so on, reading left to right, top to bottom, with the empty space ending up in the bottom-right corner. It sounds simple, and the rules truly are, yet arranging the final few tiles teaches you a surprising amount about planning ahead. This version offers three board sizes — a gentle 3×3 with eight tiles, the classic 4×4 with fifteen, and a demanding 5×5 with twenty-four — plus a move counter, a timer and a ranked score, so you can race your own best or climb the leaderboard.
The goal
Rearrange the scrambled tiles into ascending order using as few moves and as little time as possible. The puzzle is solved the instant every number sits in its home square: 1 in the top-left corner, counting across each row, with the blank space in the bottom-right corner. The fewer moves and seconds you spend, the higher your score.
A puzzle that drove the 1870s crazy
The 15 Puzzle set off one of the first true puzzle crazes. In the late 1870s the “Gem Puzzle” began circulating in the north-eastern United States, and by 1880 the mania had crossed to Europe: newspapers wrote of players fiddling with the little tiles on trams, in shops and in parliament sessions. The showman Sam Loyd later claimed to have invented it and famously offered a $1,000 prize for solving a version with the 14 and 15 swapped — a prize he could never lose, because mathematicians had already proven in 1879 that exactly half of all tile arrangements are impossible to solve. Swapping just one pair of tiles puts the puzzle in the unsolvable half. That elegant piece of mathematics — the parity argument — is why our shuffler only ever deals you positions it can prove are solvable.
The board and the shuffle
Pick a board size from the selector: Easy is 3×3 (tiles 1–8), Medium is the classic 4×4 (tiles 1–15) and Hard is 5×5 (tiles 1–24). Every new game starts from the solved position and is scrambled by applying hundreds of random legal slides, exactly as if an invisible hand had shuffled it tile by tile. Because only legal moves are used, every puzzle you are dealt is guaranteed solvable — there are no trick deals. The timer starts on your first move, not when the board appears, so you can study the position for as long as you like before committing.
How to move tiles
- Tap or click any tile that sits directly above, below, left or right of the empty space — it slides into the gap. Tiles that are not next to the gap cannot move.
- On a keyboard, use the arrow keys (or WASD): the key names the direction a tile slides. Press Up and the tile below the gap slides up into it, press Left and the tile to the right of the gap slides left, and so on.
- Only one tile moves per press — there is no dragging of whole rows. Each slide counts as one move on the counter.
- Tiles that have reached their home square glow softly green. That is only feedback — you may still move them, and in fact you often must temporarily break a solved row to finish the puzzle.
Winning and scoring
The game ends the moment the last tile clicks into place. A banner shows your move count, your time and your score, and the score is submitted automatically to the leaderboard for the board size you played. Your best result on this device is remembered per size, so each difficulty has its own record to beat. Sign in and your best scores also appear on the global rankings.
Strategy tips
- Solve row by row from the top. Finish the entire first row, then the second, and never disturb a completed row again. On the 4×4 board this leaves you a 2×4 strip that is much easier to reason about.
- Learn to “chase the blank”. To move a tile one square left, the gap must be on its left. Walk the gap around the tile — never through it — and you can carry any tile anywhere without wrecking your work.
- The last two tiles of each row need a trick: park the second-last tile in the corner, bring the last tile directly beneath it, then rotate both into place in one sweep. Trying to place them one at a time is the classic beginner trap.
- When you are down to the final 2×3 or 2×2 block, solve the remaining columns left to right with the same corner trick turned sideways. The very last three tiles always fall into place with a simple rotation.
- For a high score, favour fewer moves over raw speed at first — every move costs a point but a second costs two, so calm, planned play beats frantic sliding. Speed comes naturally once the routes feel familiar.
Frequently asked questions
How is the score calculated?
Score = max(1, 10000 − seconds × 2 − moves). You start from 10,000 points; every second that passes costs 2 points and every slide costs 1 point, and the score never drops below 1. Higher is better, and each board size (Easy, Medium, Hard) has its own leaderboard, so a 5×5 solve is only ever compared with other 5×5 solves.
Is every shuffle actually solvable?
Yes — guaranteed. Half of all random tile arrangements are mathematically impossible (that is the famous 14–15 swap trap), so we never deal a raw random arrangement. Instead each puzzle is scrambled by applying hundreds of random legal slides starting from the solved board, which can only ever produce reachable — and therefore solvable — positions.
I keep breaking rows I already solved. What am I doing wrong?
Nothing — that is part of the puzzle. The last two tiles of every row, and the whole final two rows, cannot be placed one at a time; they must be rotated into place together, which means briefly disturbing tiles that look finished. Follow the corner trick described in the strategy tips and the pieces will click back in order.
Which board size should I start with?
Start on Easy (3×3). It teaches the blank-chasing motion and the final rotation in a couple of minutes. The classic 4×4 is the sweet spot of challenge and length, while 5×5 rewards players who have internalised the row-by-row method — it is the same technique, just applied more times.
Does the game work offline?
Yes. Once the page has loaded, shuffling, sliding, the timer and scoring all run entirely in your browser — no connection needed. Scores earned offline are stored on your device and upload automatically the next time you are online and signed in.