Skip to content
PlayPumpkin

Tower of Hanoi

Discs

Play Tower of Hanoi Online for Free

Move the whole tower to the right-hand peg, one disc at a time, never a disc on a smaller one. Each count from 3 to 8 discs keeps its own fewest moves and best time.

How to play

  1. Choose 3 discs for a first go, then press Play.
  2. Tap the left peg to lift its top disc.
  3. Tap the peg it goes to: an empty one, or one with a bigger disc on top. A disc that can’t go there shakes and stays lifted. Dragging works too.
  4. Get every disc onto the peg marked Goal. A tower on the middle peg doesn’t count.

Par is the fewest moves there are. Time starts with your first move or Hint. A lifted disc goes back on its own peg for free, but there is no Undo: once a disc is down, moving it back costs a move.

Controls

Action Touch Mouse Keyboard
Lift a peg’s top disc Tap the peg Click the peg 1, 2 or 3 (left, middle, right); or Enter, Space, Up or W on the chosen peg
Put it on another peg Tap that peg Click that peg That peg’s number; or Left or Right (A or D) to it, then Enter, Space, Down or S
Put it back Tap its own peg Click its own peg Its own peg’s number, or Enter, Space, Down or S over its own peg
Move a disc in one go Drag it to the peg Drag it to the peg Two numbers, such as 1 then 3
Show the next move Hint Hint H
Pause Pause button Pause button Esc

Tips and strategy

Move disc 1 every other move, always the same way round

Disc 1 makes moves 1, 3, 5 and so on. With 3, 5 or 7 discs it goes right, middle, left and round again, so the first move is disc 1 onto Goal. With 4, 6 or 8 it goes middle, right, left.

Between disc 1’s moves, there is one choice

When it isn’t disc 1’s turn, the two pegs it isn’t on allow exactly one move between them. For 3 discs that gives the whole solution: 1 right, 2 middle, 1 middle, 3 right, 1 left, 2 right, 1 right.

The biggest disc moves once, halfway through

With 4 discs, disc 4 goes on move 8 of 15, once discs 1 to 3 stand on the middle peg. The first 7 moves build that smaller tower; the last 7 carry it across.

About the Tower of Hanoi

Édouard Lucas, a French mathematician, put the puzzle on sale in 1883 under the name N. Claus (de Siam), an anagram of Lucas d’Amiens. Its instructions told of Brahmins at Benares moving a gold tower of 64 discs by the same rules. At one move a second, that takes about 585 billion years.

Frequently asked questions

How many moves does it take to solve the Tower of Hanoi?
At least 2 to the power of the number of discs, minus 1: 7 for 3 discs, 15 for 4, 255 for 8. Each extra disc doubles it and adds 1. The game shows it as Par.
What does Hint do in this game?
It lifts the next disc of the shortest solution from where you are and outlines the peg it goes to; you put it down. After one hint, that game keeps no best time or fewest moves.
Why is it called the Tower of Hanoi?
Because its French inventor sold it as a game brought back from Tonkin, then the name for northern Vietnam, where Hanoi is. The story was made up; the puzzle was his own.

More like this

Add PlayPumpkin to your home screen