Three discs on one peg, one move at a time, and you keep getting stuck. Here’s how to solve the Tower of Hanoi: the full 7-move answer for three discs, the one plain idea behind it, the pattern that counts the moves, and a 4-disc challenge to try with coins at home.
The rules in 30 seconds
There are three pegs, called A (the start), B (the middle) and C (the target). A stack of discs sits on peg A, and each disc is smaller than the one under it. Your goal? Move the whole stack to peg C.
Three rules:
- Move one disc at a time.
- Only the top disc of a peg can move.
- Never put a bigger disc on a smaller one.
Number the discs 1 (smallest), 2 and 3 (largest), and use these numbers and the peg letters throughout.
Set it up at home with coins
You need three coins of different sizes, or three paper circles cut to different sizes. Mark spots A, B and C on a table, then stack the coins on spot A.
The biggest coin, disc 3, goes at the bottom, with disc 1, the smallest, on top. Want 4 discs later? The same set-up works: add one more, larger coin.
How to solve the Tower of Hanoi: one idea for every size
To free the biggest disc, everything on top of it must move somewhere else first, so the spare peg, B, has to hold the smaller stack. The whole solution comes down to three steps:
- Move the smaller stack out of the way, onto the spare peg B.
- Move the big disc to the target, C.
- Move the smaller stack on top of it, from B to C.
The smaller stack is itself a smaller Tower of Hanoi, so you solve it the same way. That’s why one idea solves any size. With 3 discs, it means: the 2-disc stack goes A to B, disc 3 goes A to C, then the 2-disc stack goes B to C.
Tower of Hanoi 3 discs: the 7 moves
Each row is one move, with the pegs afterwards listed from the bottom disc to the top.
| Move | Disc | From | To | Pegs afterwards |
|---|---|---|---|---|
| 1 | 1 | A | C | A: 3, 2 · B: empty · C: 1 |
| 2 | 2 | A | B | A: 3 · B: 2 · C: 1 |
| 3 | 1 | C | B | A: 3 · B: 2, 1 · C: empty |
| 4 | 3 | A | C | A: empty · B: 2, 1 · C: 3 |
| 5 | 1 | B | A | A: 1 · B: 2 · C: 3 |
| 6 | 2 | B | C | A: 1 · B: empty · C: 3, 2 |
| 7 | 1 | A | C | A: empty · B: empty · C: 3, 2, 1 |
Moves 1 to 3 move the small stack away to B. Move 4 frees the big disc and moves it to C. Moves 5 to 7 bring the small stack back on top of it.
Disc 1 moves on every other move: 1, 3, 5 and 7. Keep to that rhythm and you won’t get stuck.
A trick for never getting lost
- Every odd-numbered move moves the smallest disc, always the same way round the pegs. With 3 discs that’s A to C, C to B, B to A, then A to C again.
- Every even-numbered move is the only legal move that doesn’t touch disc 1.
- With an even number of discs (2 or 4), the smallest disc goes the other way round: A to B, B to C, C to A. So disc 1’s first move goes to C with an odd number of discs, and to B with an even number.
- If you lose track, find disc 1 and move it one step round the same way.
How many moves? The 2^n - 1 pattern
A search over every possible position gives the fewest moves for 1 to 5 discs:
| Discs | Fewest moves |
|---|---|
| 1 | 1 |
| 2 | 3 |
| 3 | 7 |
| 4 | 15 |
| 5 | 31 |
The formula gives 63 for 6 discs and 127 for 7.
Why? To move n discs, you move the n-1 smaller discs twice and the biggest disc once. So the moves for n discs are twice the moves for n-1, plus one, and each extra disc roughly doubles the work. The counts all fit 2^n - 1, where 2^n is 2 multiplied by itself n times: 2^3 - 1 = 7.
So 7 isn’t just a solution. It’s the fewest possible moves for 3 discs, and the fewest for 4 discs is 15.
A legend tells of monks moving a stack of 64 discs. The fewest moves for 64 is 2^64 - 1, which is 18,446,744,073,709,551,615. At one move a second, that takes roughly 585 billion years.
Try it: 4 discs in 15 moves
Now the same rules with 4 discs, moving from A to C. Use the idea from earlier: the 3-disc stack to B (7 moves), disc 4 to C, then the 3-disc stack from B to C (7 more). Try it with four coins before you open the answer.
Show the answer
- Disc 1, A to B
- Disc 2, A to C
- Disc 1, B to C
- Disc 3, A to B
- Disc 1, C to A
- Disc 2, C to B
- Disc 1, A to B
- Disc 4, A to C
- Disc 1, B to C
- Disc 2, B to A
- Disc 1, C to A
- Disc 3, B to C
- Disc 1, A to B
- Disc 2, A to C
- Disc 1, B to C
Disc 1 moves on every odd move, always A to B, B to C, C to A, and so on: the even-disc rule from above. For a bigger challenge, 5 discs take 31 moves (no list).
Common mistakes
- Moving the biggest disc too early, before the stack above it has been cleared.
- Moving disc 1 back and forth between the same two pegs. In the best solution, disc 1 never moves twice in a row.
- Losing count. Write each move’s number on paper as you go: 7 for 3 discs, 15 for 4.
How did you do?
Time yourself on 4 discs and see if you can beat your first try, then try 5 discs with coins. Can you teach a friend the three steps? That’s a good test of whether you’ve got them.
Want a short puzzle to try next? See 10 brain teasers for a 5-minute break. Or read how to solve a sliding tile puzzle.





