Towers of Hanoi
Classic puzzle solver · animated · v2026
2024 Home
5

How it works

The Towers of Hanoi is a classic mathematical puzzle with three rods and disks of different sizes. The objective is to move the entire stack from rod 1 to rod 3, following these rules:

  1. Only one disk can be moved at a time.
  2. Only the top disk of a stack may be moved.
  3. No larger disk may be placed on top of a smaller disk.

Adjust the slider to change the number of disks and watch the algorithm solve it step by step. A solution for n disks requires exactly 2ⁿ − 1 moves.