Tower of Hanoi

Move the stack from the left peg to the right peg — one disk at a time.

Tower of Hanoi✕
Moves: 0Time: 0:00Optimal: 15Best: —
4
3
2
1

How to play

  • Click a peg to lift its top disk, then click another peg to drop it. Click the same peg (or press Esc) to put the disk back.
  • You may only place a disk onto an empty peg or onto a larger disk. Illegal drops are ignored.
  • Move the entire stack to the rightmost peg to win. The minimum number of moves is 2^N − 1 (shown as “Optimal”).
  • Choose 3 to 6 disks for an easier or tougher puzzle. Your best move count per disk count is saved on this device.