Solve an 8-Puzzle Step by Step
Enter the eight numbered tiles and use 0 for the empty square. The solver checks whether the board can reach the standard goal, then gives you a shortest solution with every move ready to follow.
Tap a square and type its number. Enter 0 for the blank.
- Enter 9 remaining cells, including the blank square.
The 3×3 board is selected. Enter 0 for the blank square.
How to Use the 8-Puzzle Solver
- Copy the board. Read the three rows from left to right. Enter 0 where the empty square appears.
- Check all nine positions. Each number from 0 through 8 must appear exactly once.
- Select Solve. The board is tested for solvability before a path is calculated.
- 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 type into the squares directly, use the keypad, or paste the full sequence.
What the Result Shows
Each step names the tile that moves 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 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.
8-Puzzle Solver FAQ
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. The next tile is highlighted, and the playback controls let you move forward, go back, restart, or play the sequence automatically.
Do I need to install anything?
No. Board entry, solvability checking, and solution playback run on this page in your web browser.