NewA place value chart for any number, with decimals and the Indian system. Try it free Need help? support@printsheetlab.com

Browse all topics

Tower of Hanoi

Free tower of Hanoi game with 3 to 7 disks and a move counter, plus a printable paper version.

Play the tower of Hanoi online for free: move a stack of disks from the left peg to the right peg, one disk at a time, without ever putting a bigger disk on a smaller one. Choose 3 to 7 disks, count your moves, and see the fewest possible moves for each tower, which is always 2 to the power of the number of disks, minus one. This tower of Hanoi game works on phones and tablets, needs no sign-up, and comes with a printable paper version with disks to cut out.

Tower of Hanoi game: play and print

Play the tower of Hanoi above, then print the paper version: three pegs, five disks to cut out, and a table of the fewest moves. The pictures show a new 3-disk puzzle, a 4-disk puzzle half way through its 15 moves and a perfect 3-disk solution in 7 moves.

How to play tower of Hanoi

  1. Tap a peg to pick up its top disk, then tap another peg to put it down. Keys 1, 2 and 3 also pick the pegs.
  2. Move one disk at a time. A bigger disk can never sit on a smaller one.
  3. Move the whole tower to the right-hand peg.
  4. Beat the target: the game tells you the fewest possible moves, and shows “Perfect!” if you match it.

Tower of Hanoi moves: the fewest moves for each tower

Each extra disk doubles the work, plus one more move. The fewest moves for n disks is 2n − 1, and the number of different legal arrangements of the disks is 3n, because each disk can be on any of three pegs. The last column shows how long the solution takes at one move a second:

Disks Fewest moves Legal arrangements Time at 1 move a second
1 disks 1 3 1 seconds
2 disks 3 9 3 seconds
3 disks 7 27 7 seconds
4 disks 15 81 15 seconds
5 disks 31 243 31 seconds
6 disks 63 729 1 minutes 3 seconds
7 disks 127 2,187 2 minutes 7 seconds
8 disks 255 6,561 4 minutes 15 seconds

The pattern is why 7 disks needs 127 moves, and why the game stops its menu at 7: the next tower needs 255. The famous legend of the Tower of Brahma, told when the puzzle was sold in 1883 by the French mathematician Édouard Lucas, has monks moving 64 golden disks. That would take 18,446,744,073,709,551,615 moves, about 585 billion years at one move a second. Wikipedia’s tower of Hanoi article tells the story.

Tower of Hanoi solution: the idea behind the moves

To move a tower of n disks from peg A to peg C, do three things: move the top n − 1 disks to peg B, move the biggest disk to peg C, and move the n − 1 disks from peg B onto it. The smaller job is the same puzzle, which is called recursion. For 3 disks the 7 moves are:

Move Which peg to which
1 A to C
2 A to B
3 C to B
4 A to C
5 B to A
6 B to C
7 A to C

Here A is the left peg, B the middle and C the right. The smallest disk is in the same pattern throughout: it moves every second move, and it always moves in the same direction around the three pegs. With an odd number of disks it goes to the target peg first, and with an even number it goes to the middle peg first.

Tower of Hanoi strategy for beginners

  • Start with 3 disks and aim for exactly 7 moves.
  • Move the smallest disk every other turn. The other turns are forced, because only one other move is legal.
  • Do not undo the last move. If the disk you just moved goes back, you are wasting two moves.
  • Say the plan aloud: “small to the middle, middle to the end, small on top” turns the puzzle into a chant.
  • Move up one disk at a time: when 3 is easy, try 4 and aim for 15.

How many times does each disk move?

In a perfect solution the smallest disk does most of the work, and the biggest disk moves exactly once. For a tower of n disks, disk number k from the top moves 2n − k times. For 5 disks, the moves are shared like this:

Disk Size Moves in a 5-disk solution
1 Smallest 16
2 Small 8
3 Medium 4
4 Large 2
5 Largest 1
Total 31

That is why half of all moves are the smallest disk, as the strategy tips say, and why it helps to keep an eye on it.

Tower of Hanoi printable: the paper version

The tower of Hanoi printable has three pegs, five colored disks to cut out and a table of the fewest moves. Cut the disks along the dashed lines and stack them on peg A, with the biggest at the bottom. Children can play it on the table, count moves with tally marks and compare their count with the table. It is a good activity for a quiet corner or a rainy day.

This Hanoi puzzle is one of the best logic puzzles for kids

The puzzle teaches planning, patience and the idea that a big job can be built from a smaller one. It is a classic in computer science classes because the best solution is recursive. The Common Core standards for mathematical practice ask children to make sense of problems and persevere in solving them, which is exactly what a tower of 5 disks demands. Try the sliding puzzle and tic tac toe for more logic practice.

Tower of Hanoi: frequently asked questions

What is the tower of Hanoi?

It is a puzzle with three pegs and a stack of disks of different sizes. The goal is to move the whole stack to another peg, one disk at a time, without placing a larger disk on a smaller one.

What is the fewest number of moves for the tower of Hanoi?

For n disks, the fewest moves is 2 to the power n, minus 1. That is 7 for 3 disks, 15 for 4, 31 for 5, 63 for 6 and 127 for 7.

How many disks should a beginner start with?

Start with 3 disks, which can be solved in 7 moves. Move up to 4 and 5 when 3 is easy.

Is the tower of Hanoi game printable?

Yes. The printable paper version has three pegs and five disks to cut out, plus a table of the fewest moves.

Is the tower of Hanoi game free, and do kids need an account?

Yes, it is free, and no account is needed. Best scores are saved only in the browser on this device.

Does it work on phones and tablets?

Yes. Every game is built for touch first and also works with a mouse on a computer.

More logic and brain games