Search for a tool
24-Puzzle Solver

Tool/Solver for the 24-puzzle (5x5 sliding Puzzle). Get the detailed step-by-step solution and check in one click if your puzzle is solvable.

Results

24-Puzzle Solver -

Tag(s) : Number Games, Board Games

Share
Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!


Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!


Feedback and suggestions are welcome so that dCode offers the best '24-Puzzle Solver' tool for free! Thank you!

24-Puzzle Solver

24-Puzzle Solver


Loading...
(if this message do not disappear, try to refresh this page)




See also: Magic Square

24-Puzzle Generator




Answers to Questions (FAQ)

What is a 24 puzzle? (Definition)

The 5x5 sliding puzzle, or 24-puzzle, is a puzzle game consisting of a square grid of 25 squares (5 rows and 5 columns).

This grid contains 24 tiles numbered from 1 to 24 and one empty space. The objective is to rearrange the tiles to achieve a target configuration (usually the ascending numerical order from 1 to 24, leaving the empty space in the last position). Movement is made only by sliding an adjacent tile into the empty space (up, down, left, or right), which moves the empty space to the tile's previous position.

Why are some 5x5 puzzles unsolvable?

The solvability of a 5x5 sliding puzzle relies on the parity of the permutations. Since the grid width is odd, a configuration is solvable if and only if the total number of inversions is even.

An inversion is defined as any pair of tiles $ (i, j) $ such that $ i > j $ while $ i $ precedes $ j $ when reading the grid linearly (row by row, from left to right).

If the number of inversions $ I $ is odd, the position belongs to the set of configurations that are physically inaccessible from the ordered state.

Example: Swapping two adjacent tiles in a finite solution (swapping tiles 23 and 24) creates a single inversion ($ I = 1 $), rendering the puzzle unsolvable.

Are there any variations of the 5x5 sliding puzzle?

Several variations modify the combinational structure or the rules of movement:

— N-times-N-puzzles: simpler formats like 3x3 (8-puzzle) or 4x4 (15-puzzle), and more complex ones beyond that.

— Constraint-based puzzles: the presence of fixed squares (walls) or irregularly shaped tiles.

— Toroidal puzzle: the edges are connected, allowing a tile that exits on the right to reappear on the left.

— Graphic puzzle: uses a cut-out image instead of numbers, which can introduce ambiguities in solving if tiles are visually identical.

— 3D puzzle: uses movement in three dimensions, often used in wooden puzzles.

How many configurations are there for the 5x5 puzzle?

The state space of a 5x5 puzzle is immense. For 25 positions, there are 25! theoretical arrangements. Since only half of these positions are accessible by sliding, the number of solvable configurations is defined by the formula $ \frac{25!}{2} $

This represents approximately $ 7.7 \times 10^{24} $ configurations, which is more than the number of configurations of the classic Rubik's Cube ($ 4.3 \times 10^{19} $)

What is the maximum number of moves required to solve 24 puzzle?

The maximum number of moves required to solve any solvable configuration (often called the God Number) is not yet known precisely for the 5x5 format, but estimates suggest that the diameter of the graph exceeds 200 moves.

Source code

dCode retains ownership of the "24-Puzzle Solver" source code. Any algorithm for the "24-Puzzle Solver" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "24-Puzzle Solver" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "24-Puzzle Solver" or any other element are not public (except explicit open source licence). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.

Cite dCode

The content of the page "24-Puzzle Solver" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).

Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).

To cite dCode.fr on another website, use the link: https://www.dcode.fr/24-puzzle-solver

In a scientific article or book, the recommended bibliographic citation is: 24-Puzzle Solver on dCode.fr [online website], retrieved on 2026-02-22, https://www.dcode.fr/24-puzzle-solver

Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Questions / Comments

Feedback and suggestions are welcome so that dCode offers the best '24-Puzzle Solver' tool for free! Thank you!


https://www.dcode.fr/24-puzzle-solver
© 2026 dCode — The ultimate collection of tools for games, math, and puzzles.
â–˛  
Feedback