Sliding Puzzle Generator
Exactly half of all arrangements of a sliding puzzle are impossible to solve, which is the famous trap: shuffling the tiles like cards gives you a coin-flip chance of an unsolvable board. This scrambles by sliding instead, so every puzzle it produces is genuinely solvable — and then confirms that independently using the parity rule, which decides solvability from the tile order and the position of the blank alone.
What this generator does
Scrambles from the solved board by repeatedly sliding a tile into the blank, which makes every position reachable by construction. It then confirms solvability a second way using the parity rule, and on the 3x3 board runs a breadth-first search over every reachable position to report the shortest possible solution.
How to use this tool
- Choose a board size and how many scrambling slides to apply.
- Solve it by sliding tiles back into order, blank in the bottom-right.
- On the 3x3 board, compare your solution length with the shortest one found by search.
- Increase the scramble count for a harder start — though the shortest solution grows more slowly than you would expect.
Understanding the controls
- Board size
- 3 gives the 8-puzzle, 4 the classic 15-puzzle, 5 a 24-puzzle. Only the 3x3 board is small enough to search for the shortest solution.
- Scramble moves
- How many slides to apply from solved, between 1 and 200. Beyond about 30 the puzzle stops getting meaningfully harder, because slides undo each other.
- Seed
- Any word reproduces exactly the same scramble, so the same puzzle can be set for several people.
Common use cases
- Generating solvable practice puzzles for a physical or printed board
- Teaching the parity invariant that decides solvability
- Benchmarking a sliding-puzzle solver against a known optimum
- Showing why shuffling tiles at random is the wrong way to scramble
- Setting the same scramble twice from a seed
How this generator works
Sliding is its own guarantee: every move is reversible, so a board reached by sliding can always be returned by reversing the moves. The parity check is genuinely independent — it counts pairs of tiles that are out of order and, on an even-width board, adds the blank's distance from the bottom row. On an odd board the count must be even; on an even board the total must be odd.
Randomness and fairness
The scramble is random; solvability is guaranteed by construction and then verified by the parity rule. A seed reproduces the scramble exactly and is therefore explicitly not cryptographically secure. Without a seed the browser's cryptographically secure generator is used.
For how randomness is produced across the whole site, see how Generate Random works.
Limitations and good to know
- The shortest solution is only computed on the 3x3 board; a 4x4 has around ten trillion positions, which needs a proper solver rather than a breadth-first search.
- Board sizes from 3x3 to 5x5.
- The puzzle is displayed rather than played — there is no interactive sliding here.
- Scramble counts beyond about 30 add little difficulty, since random slides frequently undo each other.
- A scramble is gone on reload — note the seed to set the same one again.
Privacy and your data
The scramble and any search run in your browser alone. Nothing about the board or your seed leaves the device.
Related generators
- Tower of Hanoi SolverThe complete optimal move list for any number of discs, replayed against the rules and checked against the two-to-the-n bound.
- Knight's Tour GeneratorA knight's route visiting every square of the board exactly once, with every step re-checked as a legal knight move.
- Maze GeneratorPrint a maze with exactly one route from start to finish — three textures from long corridors to short dead ends, any size up to 40 by 40.
- Cube Scramble GeneratorScramble sequences in standard cube notation with no redundant turns — no repeated face, and never three moves in a row on one axis.
- N-Queens Puzzle GeneratorQueens placed so none attacks another, with the placement re-verified and the total number of solutions counted exactly.