Tower of Hanoi

Loading game…
Rotate your device for the best experience
Tower of HanoiPuzzle Game info & more games
Tower of Hanoi game

Tower of Hanoi

Puzzle1 playerDesktop · Tablet · Mobiletower of hanoilogicbrain teaserrecursiondisks

Move a stack of seven colored disks to another peg, never placing a bigger disk on a smaller one, in this free Tower of Hanoi puzzle for your browser.

About Tower of Hanoi

Tower of Hanoi is the timeless logic puzzle with three pegs and a stack of seven colored disks. Your job is to move the whole tower from the left peg to one of the other two, one disk at a time, without ever putting a larger disk on top of a smaller one.

The rules take seconds to learn, but the solution rewards careful thinking: the shortest possible answer takes exactly 127 moves. The move counter sits next to the minimum, and three stars show how close you are to perfect, dropping as extra moves pile up. Your best result and your puzzle in progress are saved in the browser, so you can come back and finish later.

Big disks fill the screen on computers, tablets and phones in either orientation, and you can play by tapping pegs or by dragging disks with your finger or mouse. It is a calm brain teaser for puzzle fans, students learning about recursion and anyone who wants to train patience and planning.

How to play

Tap or click a peg to lift its top disk, then tap another peg to drop it there, or simply drag the disk onto the new peg. A disk can only go on an empty peg or on a larger disk; tap the same peg again to put a lifted disk back. Move all seven disks onto the middle or right peg to win, using as few moves as possible.

Controls

Click / Tap peg
Lift the top disk, or drop the lifted disk there
Drag disk
Move the top disk straight to another peg
1 / 2 / 3 keys
Select the left, middle or right peg
Esc
Put the lifted disk back
R / Restart button
Restart the puzzle

Tips

  • With an odd number of disks like seven, move the smallest disk to the peg where you want the tower to end up first.
  • Move the smallest disk every other turn, always cycling in the same direction around the pegs.
  • On the turns between, make the only legal move that does not involve the smallest disk.
  • Aim for the perfect 127 moves to keep all three stars; you keep two stars up to 160 moves and one up to 228.

Screenshots

FAQ

Is Tower of Hanoi free to play?

Yes. It is completely free and runs in your browser with no download or account needed.

Can I play it on a phone or tablet?

Yes. Tap a peg to lift a disk and tap another to drop it, or drag disks with your finger. The board fills the screen in portrait and landscape.

What is the minimum number of moves?

With seven disks the best possible solution takes 127 moves (2 to the power of 7, minus 1). Finish in 127 to keep all three stars.

Is my progress saved?

Yes. Your best score and the puzzle you are working on are stored in your browser, so you can close the page and continue later.