Knight's Tour — free online math game
3-20 min
Knight's Tour

Knight's Tour

Math

Jump a chess knight onto every square of the board exactly once — twelve boards, from a 3×4 warm-up to the full chessboard and back to the start.

Score 0 Best 0

Home / Math / Knight's Tour

Knight's Tour is a free online version of the classic chess puzzle. A single knight stands on the board, and your job is to land it on every square exactly once, moving only the way a knight moves: two squares one way and one square to the side. Tap a glowing square to jump; the path you have taken is drawn across the board and every visited square keeps its step number. The catch is that squares get used up. A corner has only two ways in, and once both are spent it can never be reached — so the game watches for that and tells you, in red, as soon as it can prove a tour can no longer finish from where you are, pointing at the square that was cut off. Undo, or tap any earlier square to go back to it. Twelve boards build up the idea: small boards where tours are rare, a numbered board where some squares say which step you must land on them, a board with four squares missing, round trips that must end a knight's move from the start, and finally all sixty-four squares of a chessboard. Every board comes with a tour the game has actually found, and every numbered board has exactly one. Turn on exit counts to see how many onward moves each square leaves — the rule Warnsdorff published in 1823 — at the cost of the third star. No download, no account.

How to play Knight's Tour

  1. The knight starts on the square it is standing on. Your goal is to visit every other square exactly once.
  2. A knight moves in an L: two squares up, down, left or right, then one square to the side. It jumps over anything in between.
  3. The squares it can reach next show a green dot. Tap one to jump there.
  4. Every visited square keeps its step number, and a line traces the whole path so far. The knight may never land on a visited square again.
  5. Striped squares are missing from the board and are never visited.
  6. On a numbered board, a square with a ringed number must be visited on exactly that step, and on no other.
  7. On a round-trip board the last square must be a knight’s move from the start. Once every square is visited, jump back onto the start to close the loop.
  8. If the tour can no longer be finished — a square can no longer be both reached and left, or two squares would both have to be last — the board turns those squares red and says why.
  9. Undo takes back one jump. Tapping any earlier square on the path goes straight back to it.
  10. Exits shows, on each square you can jump to, how many onward moves it would leave you. The ? button shows a square a tour really continues through, backing up first to the latest step a tour is found from if none turns up from where you are. If the search comes back empty-handed it says so, leaves your path alone and does not use up the hint. Three per board.
  11. On a keyboard, arrow keys move the highlight, Space or Enter jumps, U or Backspace undoes, E toggles exits and H asks for a hint.
  12. Stars: three for a clean tour (no dead end, no hint, no exit counts), two for finishing without a hint, one for finishing with help.

Tips

  • Visit the corners early. A corner has only two ways in, so it is the first square to get cut off.
  • Work round the edge of the board before the middle. The middle squares have up to eight ways in and will still be reachable later.
  • When a square next to the knight has only one way left in apart from the knight, go there now — or it will be stranded.
  • Two squares that each have only one way left in cannot both be last. If you see that coming, change course before it happens.
  • On a numbered board, count the steps between the knight and the next number. If the number is five steps away, the knight must be able to reach it in exactly five jumps.
  • On a round trip, keep at least one square next to the start unvisited until the very end — it is the only place the loop can close from.
  • The red warning comes when the tour is provably lost, which is usually a few jumps after the mistake. Tap back several steps rather than one.
  • Exit counts turn every open board into a matter of picking the smallest number. Try a board without them first; the third star is for that.

FAQ

Is Knight's Tour free to play?

Yes. It runs in the browser with no download, no sign-up and nothing to buy. All twelve boards are included and unlock as you finish them.

What is the knight's tour puzzle?

It is one of the oldest chess puzzles: move a single knight so that it lands on every square of the board exactly once. It was studied by Leonhard Euler in 1759, and versions of it appear in much older Arabic and Indian manuscripts.

How does a knight move?

Two squares horizontally or vertically, then one square at a right angle — an L shape. It jumps, so nothing in between matters. Every move takes it from a light square to a dark one or back.

Is there always a tour?

No, and the small boards show it. A 3×3 or 4×4 board has none at all. On a 5×5 board a tour can only start on one of the 13 squares that share the corners’ colour, and on the 3×4 board only 6 of the 12 squares have one. Every board in the game comes with a tour it has actually found, so the one you are given can always be finished.

What is the difference between an open and a closed tour?

An open tour may finish anywhere. A closed tour, or round trip, must finish a knight’s move from where it began, so the path loops back on itself. The Round Trip and Grand Tour boards ask for closed tours; you close the loop by jumping back onto the start.

What do the numbered squares mean?

On the two numbered boards some squares show the step on which they must be visited. The numbers are chosen so that exactly one tour fits them — the game counts every tour exhaustively before a board is shown — so they can be reasoned out rather than guessed.

Why did the board turn red?

Because no tour can finish from where the knight is. Either a square can no longer be both reached and left (every way in is used, or its only way in is the knight’s next jump and it has no way out), two squares each have only one way left and cannot both be the last square, a numbered square can no longer be reached in time, or on a round trip nothing is left next to the start to finish on. The warning is never wrong, but it only fires once the loss can be shown, which is usually a few jumps after the actual mistake.

What is Warnsdorff's rule?

A rule of thumb published by H. C. von Warnsdorf in 1823: always jump to the square that leaves the fewest onward moves. The Exits button shows those counts. On the plain open boards the rule alone finishes most tours, which is why using it costs the third star. On the round trips, the numbered boards, the three-row Long Board and the board with missing squares it fails more often than it works — it knows nothing about ending next to home, about the printed steps, or about squares that are not there.

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

An enormous number. Brendan McKay counted 13,267,364,410,532 closed tours on the 8×8 board in 1997, and open tours are far more numerous still. Finding one by trial and error is still hard, because almost every path runs into a dead end long before square 64.

Does it work on a phone?

Yes. Every move is a single tap, the board scales to the screen, and even the full chessboard keeps its squares large enough to tap in portrait.