Towers of Hanoi


This Towers of Hanoi puzzle uses the <canvas> element and may not run in older browsers.

Target Moves: 33 Your Moves: 0 Speed Factor (0.1 .. 50):
Discs (1 .. 40): Pegs (3 .. 16):
  Show Moves
Disc From To

This page lets you solve a general Towers of Hanoi problem yourself. Move the tower from peg 1 to another peg.

If you are the first to do this in fewer than the target number of moves, you may receive a reward!

Click (tap) vaguely near the source peg and then click (tap) - don't drag to - the destination peg to move a disc. The selected disc will change colour after you select the source. Click 'Cancel' if you have selected a source peg and changed your mind. If nothing seems to be happening, click Cancel. Click Undo/Redo to move back and forth in your solution. Once you make a new move, the old history is lost. So take care! 'Restart' sets you up to try again with your selected number of discs and pegs. Moves can be shown in a table or hidden.

'Review Solution' button will play back your solution so far. Review speed can be adjusted using the 'Speed Factor' box.

Why not play against your friends for the fastest solution, or fastest optimal solution? Times are provided to avoid disputes. If permitted, best times for a given number of discs and pegs are stored locally (does not need Cookies).


PS If your browser has a problem with the 3D animation, try selecting 2D.