Sliding Puzzle
Slide the shuffled tiles back into order on three board sizes.
FAQ
How do I play the sliding puzzle?
Is every shuffle solvable?
How are best results stored?
How do the timer and pause work?
How to use
- Pick a board size
Choose 3×3, 4×4 or 5×5 at the top. Each switch deals a fresh layout that is always solvable, and larger boards call for longer, more careful routes.
- Slide the tiles
Tap a tile next to the empty cell to slide it into the gap. Arrow keys and WASD move tiles in the pressed direction, and a swipe on the board works the same way.
- Restore the order
The goal is a board that reads 1, 2, 3 and onward with the empty cell at the bottom right. Fix the first row, then the first column, and work inward.
- Watch moves and time
The clock starts on your first move. The finish overlay reports both counts, and every board size keeps its own fewest moves and fastest time.
- Pause or reshuffle
Press P or the pause button to stop the clock, and the game also pauses when the tab goes hidden. Tap New game at any moment for a fresh deal.
About this tool
The sliding puzzle is one of the oldest mechanical brainteasers around. The classic version, known as the 15 puzzle, spread across Europe and America in the late nineteenth century and caused something close to an obsession. The rule fits in one sentence: slide a neighbouring tile into the empty cell until the board reads in order. Learning it takes a minute, playing it well takes much longer. The gap between a tidy twenty move route and a wandering hundred move one is where the fun lives.
This version runs entirely in your browser. Every deal starts from the finished board and applies a run of random legal moves. Each layout is therefore guaranteed solvable, and dead ends can never appear. Moves and time are tracked separately, and each board size keeps its own fewest moves and fastest time in local storage. Nothing is uploaded and no account is needed. Keyboard, mouse and touch all work, with pause and restart always one tap away.
How it works
Solvability comes down to a count called the inversion number. Read the tiles row by row, skip the empty cell, and count the pairs that appear in the wrong order. For an odd board width, a layout is solvable when that count is even. For an even width you also look at the empty cell. Count its row from the bottom, and the sum of the two numbers must be odd. Legal moves only flip these values in fixed ways, so a solvable board can never drift into an unsolvable one. This game deals positions by shuffling backwards from the goal, which keeps the guarantee true by construction.
Strong players work in layers. First the top row is placed tile by tile, then the left column, and the board shrinks by one ring each time. The endgame is where most runs stall: a few tiles rotate around each other and the empty cell seems to have nowhere useful to go. The standard trick is to pin one tile in your head. Steer the empty cell around it in a small loop until everything drops into place. Planning one step ahead of the empty cell saves more moves than any amount of fast tapping.
When to use it
- A brain break on the commute
A 3×3 round usually takes under a minute and a 4×4 two or three. The page opens straight in the browser with nothing to install, which makes it a clean way to fill a queue or a train ride. Close the tab whenever you like and the board asks for nothing back.
- Number sense for kids
The tiles show their numbers clearly, so children can see the order from 1 upward while they play. The 3×3 board is gentle enough for a first try, and finishing it gives an honest sense of achievement. Sorting, planning and looking one step ahead all get a quiet workout.
- Climb through the sizes
Once 3×3 feels steady, move up to 4×4 and then 5×5. Records are kept per size, the overlay announces each new best, and comparing your results across boards becomes a small challenge of its own. Each step up changes the character of the puzzle without changing a single rule.
Tips & tricks
- Fix the first row, then the first column, and solve the rest as a smaller board.
- Keep settled tiles away from the empty cell's usual path so they stay in place.
- For the endgame, steer the empty cell in small loops around one pinned tile.
Things to watch
- Tapping without a plan
When the route is unclear it is tempting to keep sliding. Fast tapping doubles the move count and often scatters tiles you had already placed. Pause before each slide, check which way the empty cell should travel, and move with intent.
- Chasing a single tile
Walking one tile to its home and knocking it out again on the next move wastes the whole trip. After a tile is placed, protect its exit route and clear a path for the tiles still to come before you return to it.
- Forgetting the last two rows
Smooth opening rows that stall at the finish line are the classic failure mode. Layer solving always leaves a tight endgame, so learn the standard finishing loops early. A little rehearsal saves more moves than any burst of improvisation. The final ring rewards patience more than speed.