SLIDING TILES · EXACT ALGORITHM

How to Solve a Slide Puzzle (15 Puzzle): Layer Method & Parity Proof

4x4 numbered 15-Puzzle sliding tile board with tiles 1 through 15 and one open empty space

Once you learn one clean corner-tuck maneuver, knowing how to solve a slide puzzle (the classic 4×4 15 Puzzle) turns chaotic tile shuffling into a calm, repeatable 60-second routine. Invented in 1874 by postmaster Noyes Palmer Chapman in Canastota, New York—and made famous worldwide in 1880 (before Sam Loyd's 1891 $1,000 prize challenge swapping tiles 14 and 15)—the 15-Puzzle also birthed modern permutation group theory in recreational mathematics.

Why Exactly Half of Random 15-Puzzle Arrangements Are Unsolvable

In an 1879 landmark paper in the American Journal of Mathematics (Vol. 2, pp. 397–404), mathematicians Wm. Woolsey Johnson and William E. Story proved that sliding tiles preserves a strict mathematical invariant:

  • Read the 15 numbered tiles in row-major order (ignoring the blank) and count inversions (I)—every pair where a larger number precedes a smaller number (e.g., 15 before 14 = 1 inversion).
  • Let R be the row number of the empty space counting from the bottom (1 = bottom row, 4 = top row).
  • Solvability Theorem: On a 4×4 grid, horizontal slides change I by 0 and R by 0; vertical slides jump a tile past 3 neighbors (flipping the parity of I) while changing R by ±1! Because the solved board has I = 0 and the blank on the bottom row (R = 1), (I + R) is always odd across every legal state. Out of 16! = 20,922,789,888,000 physical arrangements, exactly 10,461,394,944,000 (50%) are solvable—and Sam Loyd's 14–15 swap (I = 1, R = 1 → I + R = 2, even) is mathematically impossible! Every deal on 15 Puzzle Online is generated from legal scrambles so 100% of boards are guaranteed solvable (and computer scientist Ralph Brungardt, 1999 proved every solvable 4×4 position needs at most 80 single-tile moves, "God's Number").

Step-by-Step Fringe & Corner-Tuck Method (Works Every Time)

Never try to solve all 15 tiles at once! Shrink the 4×4 grid into smaller sub-boards in three clean phases:

Phase Tiles Locked Permanently Remaining Active Area Key Trick
Phase 1: Top Row 1, 2, 3, 4 3 × 4 bottom rectangle Place 1 & 2 normally; pair 3 above 4 to tuck both into the right corner together!
Phase 2: Second Row 5, 6, 7, 8 2 × 4 bottom two rows Exact same corner tuck: park 7 at r2c4 and 8 directly below it at r3c4 with the blank at r2c3, then slide left and up!
Phase 3: Left Pairs 9 & 13, then 10 & 14 2 × 2 final square (11, 12, 15) Tuck 13 right behind 9 horizontally so they rotate into column 1 as a vertical pair!
Phase 4: Final 2×2 11, 12, 15 + blank Solved! Rotate the remaining 3 tiles clockwise or counterclockwise in 1–3 clicks—parity guarantees 11, 12, 15 fall into order!

How the "3-and-4 Corner Tuck" Works Without Disturbing 1 and 2

Beginners get stuck because sliding 3 into r1c3 leaves no room to bring 4 into r1c4 without kicking 3 back out. Do this instead:

  1. Lock 1 into r1c1 and 2 into r1c2—never touch those two squares again.
  2. Keep r1c3 and r1c4 open while positioning tile 3 into the top-right corner (r1c4) and tile 4 directly underneath it (r2c4) with the empty space at r1c3. Sliding 3 left (r1c4 → r1c3) and 4 up (r2c4 → r1c4) locks both 3 and 4 into place in two clicks! (If 4 accidentally slips under 3 while r1c3 is still occupied, simply back 3 down into row 2, clear r1c3, and repeat.)
  3. Repeat the exact same two-tile train for 7 & 8 on Row 2, then turn the idea 90 degrees sideways on the bottom two rows: place 9 at r4c1 and 13 right beside it at r4c2 with the blank at r3c1, then slide 9 up and 13 left!

Practice the corner tuck right now on 15 Puzzle Online, or test irreversible crate-pushing geometry in Sokoban Warehouse Puzzles.

Ready to test these deductions on a live board?

Play in your browser with multi-step Undo, zero timers, and automatic local progress saving.

Play 15 Puzzle Online