The knight's tour is a chess puzzle: with a single knight, moving in its L shape, you must land on every square of the board without ever repeating one. If the last square is one knight move away from the first, the tour is closed (or re-entrant) and can be walked as a cycle. Here you play by clicking squares, undo moves, ask for hints and get dead-end warnings, or let the solver finish the job from any starting square, on square or rectangular boards from 5 to 12 squares a side.
How to use
From the first jump to the full tour
Pick a board size (for example 8x8) and, for the harder challenge, switch on the closed tour. Click a square to place the knight.
Click the dotted squares to jump. If you get stuck, press Undo, or ask for a hint: it points to the square with the fewest exits, which is Warnsdorff's rule.
Would you rather see it solved? In the Solver tab pick the start square, press Solve and set the animation speed. Then export the tour as a PNG.
History
From an Indian verse to Euler and Warnsdorff
The earliest known reference is in the Kavyalankara, an Indian treatise on poetics by Rudrata (9th century), where a half-board tour appears as a poetic figure. In Europe the problem got mathematical treatment from Leonhard Euler, who analyzed it in 1759, and it became a parlor pastime in the centuries that followed.
In 1823 H. C. von Warnsdorff published the rule that carries his name: always jump to the square with the fewest exits. It is a simple one-line heuristic that solves most ordinary boards with no search at all.
Theory
On which boards a tour exists
For an m x n board with m ≤ n, a closed tour exists except in these cases (Schwenk, 1991): m and n both odd; m equal to 1, 2 or 4; m equal to 3 with n equal to 4, 6 or 8. An open tour, which need not return to the start, exists except for m equal to 1 or 2, and for 3x3, 3x5, 3x6 and 4x4 (Cull and De Curtins, 1978).
Square color explains the odd-board rule: the knight alternates between light and dark squares at every jump. On a board with an odd number of squares, an open tour has to start on the color that has one extra square, the corner color.
5x5: 25 squares, open tours only, and only from the 13 squares of the corner color.
6x6 and 8x8: have closed and open tours from any square.
3x4: has an open tour but no closed one.
3x3, 3x5, 3x6 and 4x4: no tour at all.
Strategy
How to play with Warnsdorff's rule
Before each jump, look at the free squares the knight can reach and count how many free exits each would have. Go to the one with the lowest count. The idea is to avoid stranding squares: a square left with no free neighbors can never be visited.
The game warns you when a free square is already stranded (it gets a red outline), so you know to undo before spending more moves. The hint and the Warnsdorff counts are at hand to train your eye.
Embed
Use this tool on your site
Paste the code into your HTML and the tool shows up on your page, without J-Kit's navigation and ads. It still runs in the browser of whoever visits your site.
<iframesrc="https://jkit.tools/embed/en-US/knights-tour"width="100%"height="600"style="border:0"loading="lazy"referrerpolicy="no-referrer-when-downgrade"title="Knight's Tour: Puzzle and Solver"></iframe><p style="font-size:12px;margin:6px 0 0">Tool by <a href="https://jkit.tools/en/tools/knights-tour">J-Kit</a></p>
Cite
Cite or link to this tool
Using it in a paper, class or post? Copy the link or a ready-made reference. The access date is today's.
<a href="https://jkit.tools/en/tools/knights-tour">Knight's Tour: Puzzle and Solver</a>
References
Sources and references for this tool
These references help contextualize formulas, standards, APIs and limitations used on this page. They do not replace professional validation when a result has legal, financial, medical or operational impact.
It is the problem of taking a chess knight through every square of a board, visiting each exactly once, using only its L-shaped move. When the last square is one knight move from the first, the tour is called closed or re-entrant, because it forms a circuit.