Tower of Hanoi. Move the whole tower to the last peg, one disc at a time, never putting a larger disc on a smaller one. Each peg is a button: press one to lift its top disc, then press another to set it down.
Tower of Hanoi: Play the Classic Disc Puzzle Free Online
The classic disc puzzle by its real rules: move the whole tower to the last peg, one disc at a time, never a larger disc on a smaller one. 3 to 12 discs, a move counter against the fewest possible, four-peg, scrambled and adjacent modes, a Daily Tower and a watch-it-solved demo.
What is Tower of Hanoi?
Tower of Hanoi is the classic disc puzzle, free to play online here on your phone, tablet or computer. A tower of discs sits on the first of three pegs, largest at the bottom. Your job is to rebuild it on the last peg.
There are only two rules. You move one disc at a time, and a larger disc may never rest on a smaller one. That is all, and it is enough to keep people busy since 1883.
Start with 3 discs and seven moves, or build up to 12 discs and 4,095. A counter shows your moves against the fewest possible, worked out by the game's own solver. Match it for three stars.
When the classic tower feels easy, try Four Pegs, a scrambled start, Adjacent moves only, or the Daily Tower that is the same for everyone. Stuck? Press Watch and see it solved.
How to play Tower of Hanoi

Meet the board
Three pegs, one tower. Every disc starts on peg A, and you rebuild the tower on the glowing goal peg. Pick a mode and a size at the top.

Move the top disc
Drag the top disc to another peg, or tap one peg and then another. On a keyboard, press 1 and then 3.

Bigger never sits on smaller
That is the one rule. Try to put disc 2 on disc 1 and the game says Not there, and nothing is counted.

Chase the fewest moves
The counter shows your moves beside the fewest possible. Match it for three stars. Undo and Redo are free, so try things.

Ask for a hint
With 3 or 4 discs you get two hints per board. A gold arc shows the best next move. You still make it yourself.

Watch it solved
Press Watch and the game plays the shortest answer, naming what each move is for. Pause, step or change speed. It never counts as a win.

Try the other towers
Four Pegs adds a spare peg, Scramble scatters the start, Adjacent only allows the peg next door, and the Daily Tower is new each day.
The rules in full
- The goal: move every disc from peg A to the last peg, so the tower stands there in the same order, largest at the bottom. The goal peg glows green and is labelled Goal.
- Move one disc at a time. Only the top disc of a peg can move.
- A disc may land on an empty peg or on a larger disc, never on a smaller one. The game stops an illegal move and tells you why.
- With a mouse or finger, drag the top disc to another peg and let go. Or tap a peg to lift its top disc, then tap the peg where it should go.
- On a keyboard, press 1, 2 or 3 (or A, B, C) to lift from that peg, then the number of the peg to drop on. The arrow keys and Space work too.
- The counter shows your moves next to the fewest possible. Three stars for matching it, two for staying within half as many again, one for any solve.
- Undo takes back a move, as many times as you like. Redo puts it back. Restart resets the board and the clock.
- The plus and minus buttons add or remove a disc. The mode button switches between Classic, Four Pegs, Scramble and Adjacent.
- Boards with 3 or 4 discs give two hints. A hint points at the best next move and leaves you to make it.
- Press Watch to see any board solved in the fewest moves. A watched solve never counts as yours.
Tower of Hanoi tips and strategy
- Count the discs before you start. With an odd number, the smallest disc goes to the goal peg first. With an even number, it goes to the middle peg first.
- Look for the biggest disc that is not home yet. It can only cross when every smaller disc is stacked on the spare peg, so build that stack first.
- On three pegs, never move the same disc twice in a row. If you just did, one of those moves was wasted, so press Undo.
- In Four Pegs, park more than one disc. With 6 discs, set the top three aside on a spare peg, move the other three, then bring the parked ones home.
- In Adjacent, the smallest disc moves twice, then another disc moves once, over and over. The big disc reaches the goal in two short steps.
- Stuck on a size? Press Watch, slow it to 1×, and follow a single disc. Then stop the demo and try the same board yourself.
What is the Tower of Hanoi?
The Tower of Hanoi is a puzzle with three pegs and a stack of discs, each one smaller than the disc below it. You move the stack to another peg, one disc at a time, without ever putting a larger disc on a smaller one.
It was invented by the French mathematician Édouard Lucas, who sold it as a toy in 1883. It is also called the Towers of Hanoi and Lucas' Tower.
Lucas wrapped it in a legend: temple priests move 64 golden discs between three needles, and when the last one lands the world ends. No hurry. That takes 18,446,744,073,709,551,615 moves, about 585 billion years at one move a second.
Tower of Hanoi rules
This game plays by the exact rules: one disc at a time, only from the top of a peg, and never onto a smaller disc.
You win when the whole tower stands on the last peg. Rebuilding it on the middle peg does not count. Every board can be solved, and you can always undo.
How many moves does it take? The 2ⁿ − 1 formula
The fewest moves for a tower of n discs is 2ⁿ − 1. Every extra disc doubles the work and adds one move.
That gives 7 moves for 3 discs, 15 for 4, 31 for 5, 63 for 6, 127 for 7 and 255 for 8. Then 511 for 9 discs, 1,023 for 10, 2,047 for 11 and 4,095 for 12.
The counter shows this number beside your own moves. It comes from the game's own solver and is checked by a full search, so it is always the true minimum.
How to solve the Tower of Hanoi
Think in towers, not discs. To move a tower, first move everything except the biggest disc to the spare peg. Then move the biggest disc to the goal. Then move the smaller tower on top of it.
The smaller tower is moved in the very same way, and so is the tower inside that. This is why the puzzle is a favourite first lesson in recursion for programmers.
You do not have to hold all of that in your head. Move the smallest disc every other turn, always in the same direction, and make the only other legal move in between. Open The trick in the menu for pictures of both ideas.
Four Pegs: the Reve's puzzle
Add a fourth peg and the puzzle gets shorter and much deeper. The English puzzle maker Henry Dudeney published it in 1907 as the Reve's puzzle.
The spare peg lets you park several small discs out of the way. The fewest moves are 5 for 3 discs, 9 for 4, 13 for 5, 17 for 6, 25 for 7, 33 for 8, 41 for 9 and 49 for 10. Then 65 for 11 and 81 for 12.
The method behind those numbers dates from 1941, yet a full proof that nothing beats it only arrived in 2014. Here every one of those counts is confirmed by the game's own search.
Scramble and Adjacent modes
Scramble starts with the discs already spread over the three pegs, so the moves you know by heart no longer fit. The game finds the fewest moves for each scramble, and New deals another.
Adjacent allows a disc to move only to the peg next door: A to B, or B to C, and back. The tower still has to travel from A to C.
That one small rule triples the work with each disc. The fewest moves are 3ⁿ − 1: 26 for 3 discs, 80 for 4, 242 for 5, 728 for 6 and 2,186 for 7. A perfect solve passes through every possible position once.
The Daily Tower
Every day brings one new board, the same for every player. It starts scrambled, and the kind changes with the weekday: three pegs on some days, four pegs or adjacent moves on others.
Your first solve of the day is the one that counts. Solve it day after day to build a streak.
Missed a day? The last week of Daily Towers stays open to play for fun. The demo cannot be watched on today's board until you have solved it yourself.
Made to feel good on any screen
Discs follow your finger or mouse the moment you touch them, and tap-tap and the keyboard are just as quick. Each disc lands with a clack whose pitch matches its size.
Pick from five looks, Neon, Temple, Aurora, Ember and Ice, and switch on numbered discs if you like to count. Sound can be muted with one tap.
The board saves itself as you play, so you can close the page and pick up the same tower later. Nothing to download.
Tower of Hanoi FAQ
What are the rules of the Tower of Hanoi?
Move the whole tower from the first peg to the last. Move one disc at a time, only ever the top disc of a peg, and never put a larger disc on a smaller one.
What is the minimum number of moves?
For n discs on three pegs it is 2ⁿ − 1. That is 7 moves for 3 discs, 15 for 4, 31 for 5, 63 for 6, 127 for 7, 255 for 8 and 1,023 for 10.
How do you solve the Tower of Hanoi with 3 discs?
Seven moves. Call the discs 1, 2 and 3 from smallest to largest. Disc 1 to C, disc 2 to B, disc 1 to B, disc 3 to C, disc 1 to A, disc 2 to C, disc 1 to C.
Is there a trick to solving it?
Yes. Move the smallest disc on every other turn, always in the same direction round the pegs. In between, make the only legal move that does not touch the smallest disc. Start towards the goal peg with an odd number of discs, and the middle peg with an even number.
How many discs can I play with?
Classic and Four Pegs go from 3 to 12 discs, Scramble from 3 to 10 and Adjacent from 3 to 7.
How do the stars work?
Three stars for solving in the fewest possible moves, two for finishing within half as many again, and one for any solve. A solve that used a hint earns two stars at most.
Are there hints?
On Easy boards, with 3 or 4 discs, you get two hints for each board. A hint shows the best next move and you make it yourself. Bigger towers have no hints, but Undo is always free.
Does watching the solution count as a win?
No. Watch it solved is a demo. It plays the fewest moves so you can learn from them, then hands the board back to you. It adds nothing to your records or streak.
Can I play Tower of Hanoi on my phone?
Yes. It runs in the browser on phones, tablets and computers, upright or sideways. Drag a disc, or tap a disc and then tap a peg. Nothing to install.
How long would 64 discs take?
The legend's 64 discs need 18,446,744,073,709,551,615 moves. At one move every second, without a single mistake, that is roughly 585 billion years, far longer than the age of the universe.
More games
Maze Escape
Guide a glowing wisp out of mazes of every shape: square, hex, triangle, ring, weave and multi-floor towers, with keys and doors, one-way gates, teleporters and fog. A 120-maze campaign, a Daily Maze and a free-play maze maker.
PLAY →Ringlock
A circular sliding puzzle: turn the curved pieces around their rings, swing the wide ones around two rings at once and slide the straight ones along their spokes until the golden marble can fall into the centre. 500 levels from Beginner to Insane, and a daily board.
PLAY →Orbitile
Bring colour to the cosmos: turn any square of four tiles to link each colour's stars and light up a dark, fractured sky. 300 levels across twelve star systems, a Daily Orbit, endless generated skies, Singularity Trials and a universe maker.
PLAY →Neon Gridlock
The sliding-car parking lot puzzle: clear a jammed 6×6 lot and drive the red car out the exit. Endless puzzles at four levels, a daily lot, and solver hints.
PLAY →Sudoku
A fresh daily Sudoku plus unlimited puzzles from Easy to Expert, graded by the techniques they need. Notes, hints that explain themselves, undo and a timer.
PLAY →2048
The original open-source 2048, hosted here with no ads. Slide tiles, merge pairs, reach 2048 and keep going.
PLAY →