STEP-BY-STEP SOLVER

Solve an 8-Puzzle Step by Step

Enter an 8-puzzle board, check whether it is solvable, and follow a shortest solution one move at a time. Free 3×3 solver with step playback.

3×3 & 4×4 grids supported Instant solvability check 100% local in your browser
3 × 3 BOARD 0 / 9 filled

Enter all tiles (0 for the blank) or load a random example.

1. Enter Tiles Tap a square, then a number (0 = blank)
2. Solve & Playback
Paste a board as text

Separate numbers with spaces, commas, or slashes — e.g. 1 2 3, 4 5 6, 7 8 _. Use 0 or _ for the blank.

How to Use the 8-Puzzle Solver

  1. Copy the board. Read the three rows from left to right. Enter 0 where the empty square appears.
  2. Check all nine positions. Each number from 0 through 8 must appear exactly once.
  3. Select Find moves. The board is tested for solvability before a path is calculated.
  4. Follow the highlight. Move the highlighted tile into the blank, then advance to the next step.

A solved board reads 1 2 3 4 5 6 7 8 0. You can tap into the squares directly or use the keypad below the board.

What the Result Shows

Each step is one tile moving into the empty square. Next and Prev let you inspect the sequence at your own pace; Play animates the same moves, and Restart returns to the board you entered.

For 3×3 boards, the returned sequence is a shortest path to the standard goal. If more than one shortest path exists, the solver only needs to show one of them. How the search decides which move comes next is worked through in A* search for the 8 puzzle.

How the Solver Detects an Impossible Board

Ignoring the blank, read the tiles row by row and count each pair where a larger number appears before a smaller one. A 3×3 board can reach the standard goal when that inversion count is even.

This divides the 362,880 possible arrangements into two equal groups: 181,440 solvable positions and 181,440 positions that cannot cross into the goal group through legal slides. The check happens before the solver starts building a move sequence, so an impossible board comes back as an answer rather than a failed search.

Swapping any two tiles by hand flips that parity — which is exactly how the 14-15 puzzle made its name in 1880. On a 3×3 the same trick makes a board that looks finished but can never be completed.

Where to Go Next

If your puzzle is 4×4 instead of 3×3, use the 15 puzzle solver — the method of entering a board is the same, but the parity rule adds the blank's row. Want to work the board out by hand first? How to solve a slide puzzle walks through the row-and-column method, and the hardest 8 puzzle explains which 3×3 positions sit furthest from the goal.

SOLVER FAQ

Frequently Asked Questions

What is the 8-puzzle?

The 8-puzzle is a 3×3 sliding board with eight numbered tiles and one empty square. The goal is to arrange tiles 1 through 8 in reading order with the blank at the bottom right.

How do I enter the empty square?

Enter 0 for the blank. Read your puzzle from left to right and top to bottom, entering all nine positions in that order.

Does this 8-puzzle solver find the shortest solution?

Yes. For a solvable 3×3 board, the solver returns a shortest sequence of legal tile moves to the standard goal position.

Is every 8-puzzle arrangement solvable?

No. Of the 362,880 possible arrangements of eight tiles and a blank, 181,440 can reach the standard goal by legal slides. The solver checks this before searching.

Can I follow the answer one move at a time?

Yes. Next and Prev step through the sequence, Play runs it automatically, and Restart returns you to the board you entered.

Do I need to install anything?

No. Board entry, the solvability check, and solution playback all run on this page in your web browser.

CONTINUE EXPLORING

Keep Going