8×8
4

More information about the Knight's Tour

Knight's Tour

A chess knight jumps two squares one way and one square to the side. Can it visit every square of the board exactly once? Click a square to start and jump from square to square. The numbers show how many onward moves each square leaves, the clue behind Warnsdorff's rule, and Solve finishes the tour for you. Click a square to place the knight, then click a highlighted square to jump. Visit every square exactly once. The numbers count the onward moves from each square: Warnsdorff's rule takes the smallest. Solve finishes the tour and backs up first if the knight is stuck.

How it works

  1. Click any square to put the knight there. The squares it can jump to light up.
  2. Click a highlighted square to jump. A gold number marks Warnsdorff's choice: the square with the fewest onward moves.
  3. Stuck, or curious? Press Solve and watch the knight finish the tour, then save the numbered path as a PNG.

How a knight moves

A knight moves in an L: two squares in a straight line and then one square to the side, or one and then two. It is the only chess piece that jumps over others. From the middle of the board it has eight moves, from a corner only two.

Warnsdorff's rule

In 1823 H. C. von Warnsdorff suggested a simple rule: always jump to the square from which the knight will have the fewest moves left. Squares near the edge and in the corners are hard to reach, so the knight visits them while it still can. On an ordinary chessboard the rule very often finds a whole tour without any search.

Open and closed tours

An open tour ends anywhere. A closed tour ends a knight's move from where it began, so the knight could jump straight back and go round again. Closed tours exist on every even board from 6×6 up, but never on an odd one: the knight changes color with every jump, and an odd board has one more square of one color than of the other.

Frequently asked questions

Does every board have a knight's tour?

Every square board from 5×5 up has an open tour. On 5×5, 7×7, and 9×9 the tour must start on a square the color of the corners. A closed tour needs an even board of at least 6×6.

How many knight's tours are there on a chessboard?

There are 26,534,728,821,064 closed tours on the 8×8 board if a tour and the same tour run backward count separately. Open tours are far more numerous: about 19.6 quadrillion.

What does Solve do when the knight is stuck?

It backs up a few moves at a time until it finds a position from which the tour can be finished, then jumps to the end. Undo takes every step back again.

Can I make a closed tour?

Yes. Tick Closed tour before you press Solve. On an odd board a closed tour is impossible, and the app says so.

Does this upload anything?

No. The board is drawn on a canvas in your browser. Save downloads a PNG. Edit opens that image in the PictorX editor.

Ready to try it?

Open PictorX in your browser — no install, no credit card required to start.

Go to Editor