Tower of Hanoi Rules
Move only one top disk at a time from one peg to another until the full stack rests on the rightmost peg.
You may never place a larger disk on top of a smaller disk. Adjust disk count from 3 up to 7 using the − / + buttons.
How to Hit the Optimal Move Count
The minimum number of moves for N disks is 2^N − 1 (15 moves for 4 disks, 31 moves for 5 disks).
Alternate moving the smallest disk every other turn in the same cyclic direction, and make the only legal non-smallest move in between.
Controls & Adjustable Disk Count
Tap any peg to lift its top disk, then tap a destination peg to place it. Use the − and + buttons in the header to scale the puzzle from a quick 3-disk warm-up (7 optimal moves) up to a challenging 7-disk tower (127 optimal moves).
Common Tower of Hanoi Mistakes to Avoid
Moving the smallest disk in alternating directions breaks the rhythmic pattern and doubles your move count. Always cycle the smallest disk in one consistent direction (left-to-right or right-to-left) on every odd-numbered move.
Tower of Hanoi FAQ
- What is the minimum move count for 4 disks?
- Four disks can be solved in exactly 15 moves. The optimal count for any disk size is displayed right next to your move counter.
- Can I change the number of disks?
- Yes. Use the − and + buttons at the top of the board to play anywhere from 3 to 7 disks.
- Does Tower of Hanoi work on mobile?
- Yes. Simple tap-to-pick and tap-to-place controls work smoothly on phones and tablets.
- Is Tower of Hanoi free with no sign-up?
- Yes. It runs directly in your browser for free with no download.
- What is the mathematical formula for minimum moves?
- The optimal move count for N disks is always 2^N minus 1—for example, 3 disks take 7 moves and 5 disks take 31 moves.
- Can I move two disks at the same time?
- No. Classic Tower of Hanoi rules only allow moving one top disk per turn.
Open-Source License & Credit
Playable Tower of Hanoi is open-source HTML5 software inspired by Douile/tower-of-hanoi, used under the MIT License and self-hosted on watersortgame.org.