STRATEGY • ALGORITHMS • LOGIC

Tower of Hanoi

Move the disks in order and solve the puzzle. Can you finish in the target number of moves?

🏆 Leaderboard Top 5
Your name:

Score saved! Enter your name:

Loading…

One at a Time

On each turn, you may move only the top disk from one tower to another.

Size Rule

You may never place a larger disk on top of a smaller one.

Minimum Moves

Try to solve the puzzle in the target number of moves for your chosen level.

Number of Disks

Tower of Hanoi: Algorithmic Thinking and Planning

The Tower of Hanoi is an iconic logic puzzle that trains algorithmic thinking and multi-step planning. To move every disk legally, you must look beyond the next turn and anticipate the moves that follow.

Skills You Can Use Every Day

It is especially useful practice for anyone interested in programming logic or mathematical optimization. Finding the shortest error-free solution builds patience, focus and resilience in problem-solving.

Tower of Hanoi
Move every disk to another tower!
Moves: 0
Target: 15
Best:

How to Play

Tap a tower to lift its top disk, then tap the destination tower. Move the entire left tower to the middle or right tower in the same order.

Strategy

Think about the whole puzzle. Before moving the largest disk, every smaller disk above it must be stacked on the spare tower.

What Is the Tower of Hanoi?

The Tower of Hanoi is a classic logic puzzle with three rods and a stack of disks in different sizes. Every disk starts on one rod, largest at the bottom and smallest at the top. Your task is to rebuild the same tower on another rod while following two simple rules.

French mathematician Édouard Lucas introduced the puzzle in 1883. His story featured temple priests moving 64 golden disks. A perfect solution would take more than 18 quintillion moves, so our free online version keeps things friendlier with 3 to 6 disks.

How to Play

The easiest way to solve the puzzle is to break one large problem into smaller versions of the same problem:

  • Choose 3, 4, 5 or 6 disks. Three is ideal for learning the rules; six is a serious planning challenge.
  • Click the rod holding the disk you want, then click its destination. Only the top disk can move.
  • Move one disk per turn. You cannot lift disks that have another disk above them.
  • Never place a larger disk on a smaller one.
  • Complete the whole tower on either the middle or right rod.
  • Your move count is saved when you finish. A minimum-move solution earns three stars.

Quick tip: with an odd number of disks, move the smallest disk toward the target rod first. With an even number, move it toward the spare rod.

Minimum Moves and Winning Strategies

The shortest solution always follows 2n − 1, where n is the number of disks. Every added disk almost doubles the work:

DisksMinimum Moves
37
415
531
663
7127
8255
101,023
  • Alternate moves of the smallest disk with the only other legal move.
  • Keep the smallest disk moving in the same direction throughout a perfect solution.
  • Think recursively: to free the largest disk, first solve the smaller tower above it.
  • Avoid immediately reversing a move. It adds two turns without advancing the puzzle.
  • Master the seven-move, three-disk pattern before increasing the difficulty.
  • Use Undo to study mistakes, then restart and try to complete the pattern cleanly.

What Skills Does It Train?

This small puzzle works several useful mental skills at once:

  • Planning: You learn to consider several steps before committing to a move.
  • Problem-solving: A complex goal becomes a sequence of smaller, repeatable tasks.
  • Focus and patience: A perfect six-disk solution requires 63 accurate moves.
  • Mathematical thinking: The repeating structure makes recursion and exponential growth tangible.
  • Working memory: You keep disk positions and the next part of your plan active at the same time.

Frequently Asked Questions

How many moves does the Tower of Hanoi take?

The minimum is 2 to the power of n, minus 1, where n is the number of disks. That means 7 moves for 3 disks, 15 for 4, 31 for 5 and 63 for 6.

Who invented the Tower of Hanoi?

French mathematician Édouard Lucas introduced the puzzle in 1883 together with the legend of a temple and 64 golden disks.

Is this Tower of Hanoi game free?

Yes. You can play free on Test Merkezim without creating an account or installing anything.

How many disks can I choose?

You can play with 3, 4, 5 or 6 disks. Each disk count has its own leaderboard category.

How do I move a disk?

Click the rod holding the top disk, then click the destination rod. A larger disk cannot be placed on a smaller disk.

How are the stars awarded?

You earn three stars for the mathematical minimum, two for up to one and a half times the minimum, and one for any longer valid solution.

How do I climb the leaderboard?

Lower move counts rank higher. Complete the same disk level in fewer moves to improve your score and personal best.

Is the Tower of Hanoi suitable for children?

Yes. Three or four disks are approachable for children, while five and six disks provide a stronger challenge for older players and adults.

Ready to Start?

Begin with three disks and learn the rhythm. Then add disks and chase the minimum move count.

▶ Start Game

Want another challenge? Browse all brain games or take the free IQ test.