THE CLASSIC 4×4 FIFTEEN PUZZLE

15 Puzzle Solver

Set up the fifteen puzzle, check its parity and follow a fast solution. Choose Shortest solution when you want to search for the fewest moves.

15-Puzzle Board

4 × 4 · CHALLENGE
Ready

or use arrow keys ↑↓←→ to slide

Sliding Puzzle Board Screenshot Preview
Moves made: 0

Solver Controls

Browser-Powered

Ready to solve. Choose your layout or click Solve.

Board size

Fast mode finds a quick route in stages. Shortest guarantees fewest moves.

Enter custom numbers
Photo puzzle optional
THE FIFTEEN PUZZLE

Find the next move on a 4×4 board

The fifteen puzzle gives you fifteen numbered squares and a single gap. Your goal is to put the tiles in order, with the gap in the lower-right corner. Each move slides one tile into that gap; pieces cannot cross, jump or move diagonally.

Use the on-screen board for a quick practice game, or open Enter your own board to copy a real position. Values go from 1 to 15, and 0 marks the blank. The page rejects a missing tile or duplicate value before it searches.

The example board starts two moves from completion: slide 14 left, then 15 left. Shuffle starts a new position using legal moves, so its layout is guaranteed to be solvable.

CHOOSE SPEED OR THE FEWEST MOVES

Fast solutions and shortest paths

The 4×4 puzzle has more than ten trillion reachable arrangements. Storing every position to perform a full breadth-first search would require far too much memory. Fast solution uses small searches to place individual tiles and pairs, protects completed areas, then finishes the last 2×2. It finds a route without proving that route is shortest.

Shortest solution uses IDA* with Manhattan distance and disjoint linear conflicts. These estimates guide the search without overstating the remaining work. A completed shortest-mode search returns an optimal route, but a deep scramble can take much longer.

If a shortest search reaches its limit, try Fast solution on the same board. The result states which kind of solution you received, and the progress slider jumps to any move.

Check whether a 15 puzzle is solvable

Read the numbered tiles from left to right and top to bottom, leaving out the blank. Count every pair where a larger number comes before a smaller one. This is the inversion count. Add it to the blank’s row counted from the bottom, starting with row 1. A 4×4 board can reach the standard goal when the total is odd.

Legal shuffles preserve this parity, so the Shuffle button cannot make an impossible board. A manually copied layout may still be unreachable; the solver checks before spending time on search.

Learn the hand-solving pattern

Place early rows from left to right while keeping completed tiles in place. When only two rows remain, switch to vertical pairs. The final 2×2 is small enough to cycle into place once the previous tiles are correct.

See the full method, including examples for larger boards, in How to Solve a Sliding Puzzle . For a smaller board and guaranteed fast solutions, visit the 8 Puzzle Solver .

GOOD QUESTIONS

Frequently asked questions

What is the 15 puzzle?

The 15 puzzle is a 4×4 sliding tile puzzle with fifteen numbered tiles and one empty square. Slide one neighboring tile at a time to arrange the numbers in reading order and leave the gap at the lower right.

Will the 15 puzzle solver find an optimal solution?

Choose Shortest solution to search for an optimal route with IDA*. If it completes, the move sequence is shortest. The default Fast solution completes the board in stages and may use extra moves. Difficult shortest searches can reach the time or node limit; try Fast solution when that happens.

Why can’t I swap the final two tiles?

The 15 puzzle has a parity rule: add the number of tile inversions to the blank’s row counted from the bottom. For the standard goal, the sum must be odd. A board with only two numbered tiles swapped has the wrong parity, so no legal sequence can reach the goal.

How do I enter my own 15 puzzle?

Use the 4×4 board and type all sixteen positions in reading order, separating values with spaces, commas or newlines. Enter 0 for the empty square. The page checks that each value from 0 through 15 appears exactly once.

Why does the solver sometimes stop without a move list?

The 15 puzzle has a huge search space, particularly when proving a solution is shortest. Searches have a time and state budget. If Shortest solution reaches its limit, use Try fast solution to keep the same board and find a route without requiring the fewest moves.