Skip to content
Free Tool Arena

Games · Free tool

Tower of Hanoi

Move all disks to the right peg. Larger disks can't go on smaller. Optimal solves in 2^n minus 1 moves.

Updated May 2026

Moves

0

Optimal

15

Move all disks from the left peg to the right. You can only place a smaller disk on top of a larger one. Click a peg to select; click another to move. Optimal solves in 2ⁿ−1 moves; for 4 disks that's 15.

Found this useful?Email

Advertisement

What it does

Classic Tower of Hanoi puzzle. Move all disks from the left peg to the right, never placing a larger disk on a smaller one. Optimal solution is 2^n − 1 moves.

Embed this tool on your siteShow snippet

Paste this snippet into any page. Loads on-demand (lazy), no tracking scripts, and sized to most dashboards. Replace the height to fit your layout.

<iframe src="https://freetoolarena.com/embed/tower-of-hanoi" width="100%" height="720" frameborder="0" loading="lazy" title="Tower of Hanoi" style="border:1px solid #e2e8f0;border-radius:12px;max-width:720px;"></iframe>
Embed docs →

How to use it

  1. Click a peg to select the top disk.
  2. Click another peg to move it.
  3. Choose 3-8 disks for difficulty.

Frequently asked questions

What's the optimal move count?
2^n − 1 for n disks. So 3 disks = 7 moves, 4 = 15, 5 = 31, 8 = 255. The recursive solution is famous in computer science as the canonical recursion example.

Advertisement

Explore more games tools

100% in-browserNo downloadsNo sign-upMalware-freeHow we keep this safe →