🎮 Funsoft Free games & tools🌐 English · 한국어

🗼 Tower of Hanoi

Move every disk to the right-hand peg
6 plays today
Number of disks
Moves
0
Minimum
15
Time
0:00
Best
-
Tap a peg to pick up its top disk, then tap the peg to move it to

What is the Tower of Hanoi?

There are three pegs and a stack of disks of different sizes. The goal is to move the whole tower to another peg while following the rules. The French mathematician Édouard Lucas introduced the puzzle in 1883, and it is still the first example many people meet when they learn recursion in programming.

How to play

  1. Pick the number of disks (3 to 8). All disks start on the left peg.
  2. Tap a peg to pick up its top disk (it is highlighted), then tap the peg you want to move it to. Tap the same peg again to cancel.
  3. Get the whole stack onto the right-hand peg. Try to match the minimum number of moves shown above the board.
  4. Stuck? Use Undo, or press Auto-solve to watch the computer do it step by step (games with help are not saved as a best record).

Only two rules

Minimum number of moves

With n disks the minimum is 2ⁿ − 1 moves. Each extra disk doubles it (plus one).

DisksMinimum moves
37
415
531
8255
201,048,575

A legend tells of priests in a temple moving a tower of 64 golden disks, and when they finish, the world will end. Do the maths and that is about 18.4 quintillion moves: even at one move per second it would take more than 500 billion years, dozens of times the age of the universe. No need to worry.

How to solve it: think recursively

Moving n disks breaks down into three steps:

It is the same problem again, just one disk smaller, which is exactly what recursion means in programming. Press Auto-solve above to watch this happen.

A trick for solving by hand

Always move the smallest disk around the pegs in the same direction: to the right if the number of disks is even, to the left if it is odd. After each move of the smallest disk, there is only one other legal move, so make it. Alternate these two steps and you finish in the minimum number of moves.

FAQ

Is there a limit on undo?
No. But a game where you used undo or the auto-solve button is not saved as your best record.
What happens if I solve it in the minimum number of moves?
You get a "Perfect" message and the result is saved as your record.
How many disks can I play with?
You can choose from 3 to 8 disks. Eight disks need at least 255 moves.
What is the formula for the minimum number of moves?
With n disks the minimum is 2 to the power of n, minus 1. So 3 disks take 7 moves, 4 disks take 15 and 5 disks take 31. Every extra disk roughly doubles the work.
More free games & tools
🗂️ Games by Genre📅 Daily Challenge🇰🇷 Learn Hangul🎵 Beat Cube Dash🧩 Block Puzzle🏮 Lantern Night (Survivor)🪱 Worm Battle (Worm IO)🕳️ Hole IO Game (Black Hole Town)🛡️ Steel Evolution (Tank IO)⛄ Snowball Roll IO🎄 Christmas Games🎅 Santa Gift Delivery✉️ Letter from Santa💌 Online Christmas Card❓ Christmas Quiz🎁 Secret Santa Generator🧧 Lunar New Year🎆 New Year Countdown📅 Printable Calendar🎯 New Year’s Resolutions🧮 Math Worksheet Generator✖️ Multiplication Chart🎮 Times Tables Game🕒 Telling Time Practice🖨️ Telling Time Worksheets⌨️ Typing Test🔍 Word Search Maker📝 Word Counter🎂 Age Calculator📆 Date Difference Calculator📈 Compound Interest Calculator🧪 Periodic Table🚩 Flag Quiz➗ Fraction Calculator🌳 Prime Factorization Calculator🔗 GCF & LCM Calculator🔍 Prime Number Checker🌌 Aurora Forecast🌏 Live Earthquake Map📚 Study Timer🎄 Decorate a Christmas Tree🚪 Advent Calendar 2026❄️ Snowball Fight🏰 Prism Keep (Tower Defense)⚔️ Three Kingdoms Idle📊 Stock Market Simulator🎲 Yut Nori🏮 Korean Traditional Games🍯 Dalgona Candy Game🌺 Red Light, Green Light♞ Chess vs Computer♟️ Chess Puzzles🀄 Janggi (Korean Chess)🃏 Solitaire🂡 Blackjack🔼 Hi-Lo💣 Minesweeper⚫ Gomoku (Omok)🔴 Four in a Row⚫ Reversi🥁 Beat King (Rhythm Game)🎵 Neon Lane (4 Key Rhythm Game)🎹 Piano Tiles Game🎹 Online Piano🎄 Christmas Piano Songs🪜 Endless Stairs⚽ Penalty Shootout🏓 Ping Pong (Table Tennis)🎳 Bowling🏀 Basketball Shooting🏹 Archery⛳ Mini Golf🏒 Air Hockey🎯 Darts🎱 Pool Game (Billiards)🏎️ Drift Racing🏁 Kart Racing🏍️ Hill Climb Motorbike🚌 Bus Driver🅿️ Car Parking🚗 Car Escape Puzzle🐔 Road Crossing 3D✏️ One Line Puzzle🎲 Yacht Dice🎱 Marble Race Name Picker🥌 Alkkagi🔍 Spot the Difference🪩 Pinball💥 Artillery Game✈️ Plane Shooter (Sky Interceptors)👹 Maze Chase (Dokkaebi Maze)🧟 Zombie Survival Game🫧 Cell Grow IO🐟 Fish Eat Fish🐠 Virtual Aquarium🀄 Shisen-Sho🃏 Memory Game🌸 Puff Garden (Match-3)🎴 Go-Stop (Matgo)⚫ Go (Baduk)🃏 One Card🍝 Italian Brainrot Quiz🎃 Halloween Candy Catch🎋 Bamboo Chop🔢 2048🍉 Suika Game (Watermelon)🧱 Brick Breaker🐍 Snake🫧 Bubble Shooter🔨 Whack a Mole🦖 Dino Evolution🔢 Sudoku🟩 Nonogram🧪 Water Sort Puzzle🧩 Jigsaw Puzzles🌀 Maze Game🔢 15 Puzzle🃏 24 Game (Exactly 24)⚡ Reaction Time Test🎨 Color Test🖍️ Coloring Pages🔎 Hidden Object Games🎯 Bingo Card Generator🎈 Hangman Game🧠 IQ Test (Just for Fun)🖱️ CPS Test🖱️ Mouse Test✌️ Double Click Test⌨️ Keyboard Tester🎙️ Mic Test📷 Webcam Test🔊 Left Right Speaker Test🎧 Online Hearing Test🎥 Screen Recorder🎞️ GIF Maker🟥 Dead Pixel Test🖥️ Refresh Rate Test🎞️ FPS Test📐 What Is My Screen Resolution?👆 Touch Screen Test📏 Mouse DPI Test📡 Polling Rate Test🎹 Key Rollover Test🎮 Gamepad Tester⌨️ Spacebar Counter🎯 Sensitivity Converter🧮 eDPI Calculator🔭 FOV Calculator➕ Crosshair Generator🔴 Aim Trainer⌨️ Auto Key Presser🤖 Auto Clicker✦ Special Characters𝒜 Fancy Text Generator🔳 QR Code Generator🔐 Password Generator🧰 Image & PDF Tools📱 HEIC to JPG📐 Resize Image🔄 Image Converter✂️ Crop Image📚 Merge PDF📄 Split PDF🖨️ Images to PDF🖼️ Image Compressor🧾 JSON Formatter🔤 Base64 Encoder / Decoder🎨 Color Picker & Converter⏲️ Online Timer📅 Days Until Calculator🥁 Online Metronome🎲 Random Number Generator🎡 Spin the Wheel🏇 Horse Race Game📏 Unit Converter💵 Tip Calculator💯 Percentage Calculator⚖️ BMI Calculator✍️ Your Name in Korean🎂 Korean Age Calculator🐉 Korean Zodiac Calculator🪪 Korean Name Generator💬 Korean Phrases for Travelers🗓️ South Korea Public Holidays🎧 Vibe Coding Guide🖋️ Verified Quotes🎁 Roblox Codes🗺️ Roblox Game Guides📊 Roblox Top Games Chart💎 Robux Calculator🎄 Roblox Christmas 2026🎃 Roblox Halloween 2026 Recap🥚 Steal An Egg Pets📚 Roblox Item Database

© Funsoft · funsoft.app · All English games & tools · About · Privacy · Terms · Contact · 한국어로 보기