8 Puzzle

The 8 puzzle is the smallest classic sliding puzzle: eight numbered tiles on a 3×3 board with one gap. It's quick and friendly, and it's the best way to learn the moves before you take on the 15 puzzle.

Free, right here in your browser. No download, no sign-up.

Play the 8 puzzle

Moves 0 Time 0:00

Tap a tile next to the gap, or use the arrow keys.

How to play the 8 puzzle

Tap or click a tile next to the empty square to slide it in; tap one further along the same row or column to slide the whole line. With a keyboard, click the board and use the arrow keys. Put the tiles in order, 1 2 3 on top, 4 5 6 in the middle and 7 8 on the bottom, with the gap in the bottom-right corner.

How to solve the 8 puzzle in three steps

  1. Top row: 1, 2, 3. Slide 1 into the top-left corner. Then bring 2 and 3 in together: park 3 where 2 belongs, 2 directly below it, and walk the gap round to the top-right corner without going through the top row. Slide 3 right, then 2 up.
  2. Left column: 4 and 7. Put 7 where 4 belongs, 4 just to its right, and the gap under 7. Slide 7 down, then 4 left.
  3. The last square: 5, 6 and 8. Move the gap around the bottom-right 2×2 square, always in the same direction, until all three are in place.
Left column set-up: 7 sits where 4 belongs, 4 is beside it and the gap is below. Slide 7 down, then 4 left.

The same idea scales up to every sliding puzzle. Our guide to solving any sliding puzzle walks through it in detail.

The 8 puzzle by the numbers

Why computer scientists love the 8 puzzle

The 8 puzzle is small enough to search completely and big enough to be interesting, so it's a favourite example in artificial intelligence courses. Students use it to compare search algorithms such as breadth-first search and A*, with simple rules of thumb such as "how many tiles are out of place" or the Manhattan distance, the total number of rows and columns each tile is from home. Those same ideas help people too: fix the tiles that are furthest from home first.

Questions about the 8 puzzle

What is the 8 puzzle?

The 8 puzzle is a sliding puzzle with eight numbered tiles on a 3×3 board and one empty space. You slide the tiles into order, 1 to 8, with the gap in the bottom-right corner.

What is the most moves an 8 puzzle can need?

31. Every solvable 8 puzzle can be solved in 31 single-tile moves or fewer, and the hardest positions need exactly 31.

Is every 8 puzzle solvable?

No. Only half of the 362,880 ways to arrange the board can be solved. On a 3×3 board a position can be solved exactly when the number of inversions (pairs of tiles in the wrong order) is even. Every puzzle on slidingblock.app can be solved.

Ready for more? Try the classic 15 puzzle.

Sliding Block on iPhone: a 4×4 puzzle of soft pastel keycaps numbered 1 to 15 with one empty slot.

Sliding Block for iPhone

The sliding puzzle, made to feel wonderful

  • Soft keyboard keycaps that slide with a satisfying, creamy click.
  • Classic levels on 3×3, 4×4 and 5×5 boards, from easy to expert.
  • Speed Run: race the clock on a fresh board.
  • 16 keycap sets to collect: five to start, seven more to unlock by playing, four premium.
  • Hints that light up the right key when you're stuck. Three are free.

Free to play · Optional in-app purchases · Works offline