Home › Fun & Games › Sliding Puzzle

Sliding Puzzle

Slide the tiles back into order on a 3×3 to 6×6 board using numbers, a colorful sample picture or your own photo. Every shuffle is guaranteed solvable, and your photo never leaves your device.

Board size
Tiles
Moves0
Time0:00
Best 4×4–

Tap a tile next to the gap (or any tile in its row/column to slide several), swipe on the board, or use the arrow keys after clicking the board.

Advertisement

How to use the Sliding Puzzle

  1. Pick a board size: 3×3 is quick, 4×4 is the classic 15 puzzle, 5×5 and 6×6 are a real challenge.
  2. Choose numbers or a picture. In Picture mode, pick a sample image or press Upload your photo.
  3. Slide tiles into the gap by tapping or clicking them, swiping on the board, or using the arrow keys.
  4. Put the tiles in order: 1, 2, 3… left to right, top to bottom, with the gap in the bottom-right corner.
  5. Press Shuffle any time for a new solvable game and try to beat your best time and move count.

Why half of all shuffles are impossible

If you pull the tiles out of a 15 puzzle and put them back at random, there is a 50% chance the puzzle can never be solved. In 1880 Sam Loyd famously offered a prize for solving the "14-15 puzzle", a starting position with only tiles 14 and 15 swapped, which is mathematically impossible.

The rule uses inversions: read the tiles left to right, top to bottom (ignoring the gap) and count every pair where a larger number comes before a smaller one.

Board widthThe position is solvable when…
Odd (3×3, 5×5)the number of inversions is even
Even (4×4, 6×6)inversions + the gap's row counted from the bottom (1 = bottom row) is odd

This game checks every shuffle with that rule and swaps two tiles when needed, so you always get a puzzle that can be finished.

Board sizes compared

BoardTilesSolvable positionsHardest position (moves)
3×3 (8 puzzle)8181,44031
4×4 (15 puzzle)15about 10.5 trillion80
5×5 (24 puzzle)24about 7.8 × 1024unknown (at least 152)
6×6 (35 puzzle)35about 1.9 × 1041unknown

A simple method that always works

  1. Top row first. Bring 1, 2 and 3 into place one at a time. For the last two tiles of the row (3 and 4 on a 4×4), park 3 in the top-right corner and 4 directly below it, bring the gap to 3's target spot, then slide 3 left and 4 up.
  2. Repeat row by row until two rows remain. The rows you have finished are never touched again, so the board effectively shrinks.
  3. Finish the last two rows column by column. Place the top and bottom tile of each column as a pair, from left to right, cycling tiles around a 2×2 or 2×3 loop.

Picture puzzles are solved exactly the same way. Turn on Show numbers on picture tiles if the image has large areas of similar color. If you like logic games, also try Sudoku, 2048 or Minesweeper.

Frequently asked questions

Is every shuffle solvable?

Yes. Exactly half of all random tile arrangements cannot be solved. This puzzle counts the inversions of every shuffle (and, on even-sized boards, the row of the gap) and fixes the arrangement before you see it, so every game can be finished.

What is the 15 puzzle?

The 15 puzzle is a 4×4 frame with 15 numbered tiles and one empty space. It became a worldwide craze in 1880. You slide tiles into the gap until the numbers run from 1 to 15 in order with the gap in the bottom-right corner.

What is the fewest number of moves needed?

Any 3×3 (8 puzzle) position can be solved in at most 31 moves and any 4×4 position in at most 80 single-tile moves, which was proven by computer search. Typical human solutions take more, often 100 to 200 moves for a 4×4.

How are moves counted?

Each tile that moves counts as one move. If you tap a tile two places away from the gap, both tiles slide and two moves are added.

Is there a strategy for solving it?

Solve the puzzle row by row: finish the top row, then the second row, and so on until only a 2×3 or 3×2 block remains, then solve that last block by rotating tiles around it. Place the last two tiles of a row together by parking them in a column first.

Can I use my own picture?

Yes. Switch to Picture mode and press Upload your photo. The image is cropped to a square and cut into tiles right in your browser. It is not uploaded anywhere.

Are my best results saved?

Your best time and fewest moves for each board size are stored in your browser's local storage on this device. Use Clear best to reset the record for the current size.

Related tools