Spark AI GamesAll games
Rules guides › Tower of Hanoi

Tower of Hanoi: rules and how to solve it

The Tower of Hanoi is a classic puzzle with three pegs and a stack of discs. Move the whole tower to another peg, one disc at a time, without ever putting a bigger disc on a smaller one.

  • 2 min read
  • Puzzle

Updated 24 November 2026

Play Tower of Hanoi free
Tower of Hanoi game

The rules

  1. Move one disc at a time.
  2. Only the top disc of a stack can move.
  3. Never put a disc on top of a smaller disc.

Minimum number of moves

With three pegs, a tower of n discs needs at least 2n − 1 moves.

DiscsFewest moves (3 pegs)Fewest moves (4 pegs)
375
4159
53113
66317
712725
825533
951141

Each extra disc doubles the work and adds one. The legend says monks moving 64 golden discs would need 264 − 1 moves: at one move a second, about 585 billion years.

The easy method (works for any size)

  1. Move the smallest disc every other turn, always the same way round. With an even number of discs, go A → B → C → A. With an odd number, go A → C → B → A.
  2. On the turns in between, make the only other legal move that doesn't use the smallest disc. There is always exactly one.
  3. Repeat until the tower is rebuilt. This always finishes in the minimum number of moves.

Why it works (the recursive idea)

To move 5 discs from A to C: first move the top 4 out of the way to B, then move the big disc to C, then move the 4 from B onto it. Moving 4 discs works the same way with 3, and so on. That is why the moves double with every disc.

Solving 3 discs, move by move

Discs are 1 (small), 2 and 3 (big), all on peg A. Goal: peg C.

  1. 1 to C
  2. 2 to B
  3. 1 to B
  4. 3 to C
  5. 1 to A
  6. 2 to C
  7. 1 to C

The puzzles in our game

  • Tower Road: 5 worlds of 10 levels. Every par is the exact minimum, checked by computer, and 3 stars means you matched it.
  • Four Winds adds a fourth peg (the numbers in the right column above). Mirror Hall asks you to rebuild a target picture.
  • Narrow Bridge only lets a disc step to the next peg, and Spiral Wind only lets discs move clockwise. Both need far more moves.
  • A live counter shows "on par" or how many moves over you are, so you know if you went wrong.

Common questions

What is the minimum number of moves for the Tower of Hanoi?

2^n − 1 for n discs on three pegs: 7 for 3 discs, 15 for 4, 31 for 5, 63 for 6.

What is the trick to the Tower of Hanoi?

Move the smallest disc every other move, always in the same direction round the pegs, and make the only other legal move in between.

How many moves for Tower of Hanoi with 4 pegs?

Far fewer: 5 for 3 discs, 9 for 4, 13 for 5, 17 for 6, 25 for 7 and 33 for 8.

Is the Tower of Hanoi good for your brain?

It is a classic planning puzzle used to teach recursion and to test problem solving, and a fun one to practise.

Ready to play?Tower of Hanoi is free on phone, tablet and computer.
Play
More rules guidesSee all
More puzzle gamesSee all
Tower of HanoiFree · no download
Play