Tower of Hanoi

Tower of Hanoi, free online with no ads

The classic puzzle with donuts: move the whole tower to the right peg, one donut at a time, never a bigger one on a smaller one. 3 to 10 donuts, stars for the fewest moves.

No ads Starts instantly No sign-up

How to play Tower of Hanoi

On a computer: Click a peg to lift its top donut, then the peg to drop it on, or drag it; 1, 2, 3 or arrows and space; Z undo, H hint.

On a phone or tablet: Tap a peg to lift its top donut, tap another to drop it, or drag it.

About Tower of Hanoi

This Tower of Hanoi game is free in your browser, made by KepoGames: the classic puzzle, played with donuts. A tower of donuts sits on the left peg, biggest at the bottom, and you move the whole tower to the right peg. Only one rule: you move one donut at a time, always the top one, and a bigger donut can never go on a smaller one. The middle peg is there to help. Kepo watches from his picnic blanket, hops when you make a good move and puts on a party hat when the tower is across.

There are eight levels: 3, 4, 5, 6, 7 and 8 donuts, then two expert levels with 9 and 10. The counter shows your moves next to the fewest possible, which is 2^n − 1 for n donuts: 7 moves for 3 donuts, 15 for 4, 31 for 5 and 255 for 8. Solve a level in the fewest moves for three stars, in up to one and a half times that for two, and in any number for one. Each level you solve opens the next, and your stars and the level you are playing are saved.

Tips

  • Watch the smallest donut: in the fewest moves it moves every other turn, always going round the pegs the same way.
  • With an odd number of donuts (3, 5, 7, 9), the smallest one goes to the right peg first. With an even number (4, 6, 8, 10), it goes to the middle peg first.
  • Between two moves of the smallest donut there is only ever one other move you can make, so take it and don't overthink it.
  • Think big: to move the biggest donut to the right peg, everything above it has to be stacked on the middle peg first.
  • Made a slip? Undo takes the move back and takes it off the counter too, so you can still go for three stars.

How to play Tower of Hanoi

Tap a peg to lift its top donut: it floats above the peg. Tap another peg to drop it there, or tap the same peg to put it back. You can also drag a donut straight from one peg to another. On a keyboard, 1, 2 and 3 pick the pegs, or walk along them with the arrows and press space.

If you try to put a bigger donut on a smaller one, the donut wobbles and goes back where it was, and the move doesn't count. When every donut is on the right peg, biggest at the bottom, the level is solved. Undo takes back your last move, restart starts the level again, and the light bulb shows the best next move from wherever your donuts are.

How to solve the Tower of Hanoi puzzle

The puzzle solves itself one size at a time. To move a tower of 3 donuts, you move the top 2 to the middle peg, move the biggest donut to the right peg, then move the 2 back on top of it. Moving 4 donuts is moving 3, then the biggest, then 3 again. That's why each extra donut doubles the moves, plus one.

There's also a simple rhythm to follow. Every other move is the smallest donut, and it always goes round the pegs in the same direction: left, right, middle, left, and so on with 3, 5, 7 or 9 donuts, and left, middle, right, left with 4, 6, 8 or 10. On the moves in between, there is only one legal move that doesn't touch the smallest donut. For 3 donuts that gives the seven moves: small to the right, middle to the middle peg, small onto it, big to the right, small to the left, middle onto the big one, small on top.

Levels, stars and the fewest moves

As with all towers of Hanoi, the fewest moves for a tower of n donuts is 2^n − 1: 7 moves for 3 donuts, 15 for 4, 31 for 5, 63 for 6, 127 for 7 and 255 for 8. The expert levels need 511 moves for 9 donuts and 1023 for 10. Three stars means you did it in exactly that many; two stars means up to one and a half times as many, so 10 moves for 3 donuts; one star is any solve.

Tower of Hanoi is a good puzzle for children and for anyone learning to plan ahead: there's nothing to read, no timer and no way to lose, and the first level takes seven moves. It's free, with no ads, no sign-up and no download, and works on phones, tablets and computers in English, Spanish, Portuguese, French, Polish and Turkish.

Questions

How do you play Tower of Hanoi?

Move the whole tower of donuts from the left peg to the right peg. You move one donut at a time, always the top one of a peg, and a bigger donut can never go on a smaller one.

What is the minimum number of moves?

For n donuts it's 2^n − 1: 7 moves for 3 donuts, 15 for 4, 31 for 5, 63 for 6, 127 for 7, 255 for 8, 511 for 9 and 1023 for 10. Solve a level in exactly that many for three stars.

How do you solve the Tower of Hanoi with 3 donuts?

Seven moves: smallest to the right, middle-sized to the middle, smallest onto it, biggest to the right, smallest to the left, middle-sized onto the biggest, smallest on top.

What if I get stuck?

Tap the light bulb: it shows the best next move from where your donuts are now, not just from the start. Undo takes back moves one by one, and restart begins the level again.

Is Tower of Hanoi free?

Yes. It's free to play in your browser with no ads, no sign-up and no download, on phones, tablets and computers.

Is Tower of Hanoi free to play?

Yes. Tower of Hanoi is free and runs in your browser. There are no ads: no video before you play, no breaks between levels. There’s nothing to download and you don’t need an account.

Can I play Tower of Hanoi on my phone?

Yes. It works on phones, tablets, laptops and Chromebooks. Tap a peg to lift its top donut, tap another to drop it, or drag it on touch screens.

Who made Tower of Hanoi?

Tower of Hanoi was made by the KepoGames studio. Every game on KepoGames is made in-house.

Categories
Puzzle, Classics
Works on
Phone, tablet, computer
Released
November 2026
Made by
KepoGames studio

More games like Tower of Hanoi

See all