Tower of Hanoi: How to Play 3 to 10 Discs and Use the Solver

What is it?

Tower of Hanoi is a famous puzzle about planning. Move the whole stack of discs from the first peg to the last, one disc at a time, never putting a bigger disc on a smaller one. You can play with 3 to 10 discs, and the solver can finish from wherever you are in the fewest possible moves.

Who is it for?

Students learning recursion in computer science or powers of two in maths, teachers demonstrating problem solving, and puzzle lovers.

How to use it

  1. Choose Discs (start with 3 or 4). Restart sets the tower back.
  2. Tap a peg to pick up its top disc, then tap another peg to drop it.
  3. Move the whole tower to peg 3. Moves, Fewest possible and Time are shown above.
  4. When finished you see Tower moved., with “perfect, the fewest possible!” if you matched the minimum.
  5. Press Show me the solution to watch the solver from your current position; choose its Speed (Slow, Normal, Fast). Press it again to pause.

The maths and the trick

The fewest moves for n discs is 2ⁿ − 1: 3 discs need 7, 4 need 15, 5 need 31, 8 need 255 and 10 need 1,023.

To move n discs: move the top n − 1 out of the way, move the biggest disc, then move the n − 1 back on top. With 3 discs: small to peg 3, middle to peg 2, small to peg 2, big to peg 3, small to peg 1, middle to peg 3, small to peg 3: seven moves.

Keyboard: press 1, 2 or 3 to pick up and drop, or arrows and Enter.

Errors and how to fix them

  • “A bigger disc cannot go on a smaller one.”: the move is undone; pick another peg.
  • “Solver paused.”: you pressed the button again; press it once more to continue.
  • “Solving: 12 moves to go…”: the solver is working from your position.
  • Nothing happens when I tap: tap the peg itself (the whole column), not the empty space between pegs.

Open the tool: Tower of Hanoi

Still stuck?

Contact support. Tell us which tool or page you were using, what you tapped, what you saw, and your phone or computer and browser (for example: Android phone, Chrome). We reply by email.

Questions, or an error not listed here?

Tell us in the comments: what you were doing, the exact message you saw, and your device and browser. We read every comment and add new fixes to this article.