How to Solve Water Jug Puzzles, Step by Step
This article was written with AI and may contain mistakes. Found one? Tell us.
To solve a water jug puzzle, pick one jug as the pourer and repeat a simple loop: fill the pourer, pour it into the other jug, and empty the other jug whenever it is full. Run the loop once starting with the bigger jug and once starting with the smaller jug, and the shorter of the two routes is your answer.
This guide explains the rules, shows which amounts can and cannot be measured, works through a full example move by move, and ends with practice puzzles for you to try.
What is a water jug puzzle?
You have two or more jugs with no markings except their full size, such as a 3 litre jug and a 5 litre jug. You have a tap and a drain. Your goal is to end up with an exact amount, such as 4 litres, in one of the jugs.
Because the jugs have no measuring lines, the only amounts you can be sure of are full and empty. Every other amount has to be made by pouring one jug into another until one of them is either full or empty. That is the whole puzzle: build an exact amount out of two sizes you know.
Which moves are allowed?
Most jug puzzles use three moves. Each counts as one move.
| Move | What happens | Example with 3 L and 5 L |
|---|---|---|
| Fill | Fill one jug to the top from the tap | The 5 L jug goes from 0 L to 5 L |
| Empty | Pour one jug away down the drain | The 3 L jug goes from 3 L to 0 L |
| Pour | Pour one jug into the other until the first is empty or the second is full | 5 L poured into an empty 3 L jug leaves 2 L in the big jug |
You cannot stop pouring halfway, and you cannot guess by eye. A pour always runs until one of the two jugs hits a limit. Some puzzles, such as sharing puzzles with three jugs, allow only pours and no tap or drain. Always read which moves count before you start.
Can every amount be measured?
No, and knowing this saves a lot of time. Find the largest whole number that divides both jug sizes exactly. Every amount you can measure is a multiple of that number, and it cannot be more than the bigger jug holds, because the target has to fit in one jug.
- With 3 L and 5 L jugs, the largest number dividing both is 1. So every whole amount from 1 L to 5 L can be made.
- With 4 L and 6 L jugs, the largest number dividing both is 2. So only 2 L, 4 L and 6 L can be made. A puzzle asking for 5 L with these jugs has no solution at all.
- With 4 L and 9 L jugs, the largest number dividing both is 1, so any whole amount up to 9 L is possible.
Before you start pouring, run this check. If the target is not a multiple of the shared divisor, stop: the puzzle cannot be solved, and the right answer is to say so.
What is the loop method?
The loop method is a fixed routine that always reaches every amount that can be made. Choose one jug to be the pourer and stick with it.
- If the pourer is empty, fill it.
- Pour the pourer into the other jug.
- Check whether either jug holds your target. If it does, stop. Do this after every move, fills included.
- If the other jug is now full, empty it. Then go back to step 1.
That is all. You never need to think about which move to make next, because the loop decides for you. The only choice you make is which jug is the pourer, and you should try both.
Worked example: 4 litres with 3 L and 5 L jugs
The puzzle: you have an empty 3 L jug, an empty 5 L jug, a tap and a drain. Get exactly 4 L in the 5 L jug in the fewest moves, where filling, emptying and pouring each count as one move.
Route A: the big jug is the pourer
Each row shows the state after the move, written as small jug, then big jug.
| Move | Action | 3 L jug | 5 L jug |
|---|---|---|---|
| 1 | Fill the 5 L jug | 0 | 5 |
| 2 | Pour 5 L into 3 L | 3 | 2 |
| 3 | Empty the 3 L jug | 0 | 2 |
| 4 | Pour 5 L into 3 L | 2 | 0 |
| 5 | Fill the 5 L jug | 2 | 5 |
| 6 | Pour 5 L into 3 L | 3 | 4 |
After move 6, the 5 L jug holds exactly 4 L. Route A takes 6 moves.
Route B: the small jug is the pourer
| Move | Action | 3 L jug | 5 L jug |
|---|---|---|---|
| 1 | Fill the 3 L jug | 3 | 0 |
| 2 | Pour 3 L into 5 L | 0 | 3 |
| 3 | Fill the 3 L jug | 3 | 3 |
| 4 | Pour 3 L into 5 L | 1 | 5 |
| 5 | Empty the 5 L jug | 1 | 0 |
| 6 | Pour 3 L into 5 L | 0 | 1 |
| 7 | Fill the 3 L jug | 3 | 1 |
| 8 | Pour 3 L into 5 L | 0 | 4 |
Route B also reaches 4 L in the 5 L jug, but it takes 8 moves. So the fewest moves is 6, using route A.
Why does route A work?
Count the water that has gone into the big jug and the water that has left it. Each refill adds 5 L, and each time the small jug is filled from it, 3 L leave. After one refill and one small jugful, 5 minus 3 leaves 2 L. After two refills and two small jugfuls, 10 minus 6 leaves 4 L, which is why the target appears right after the second refill. The amounts you can see in the big jug follow the pattern 2, then 4, then 1, then 3. Every number from 1 to 4 appears before the loop repeats, which is why the loop always finds an answer when one exists.
Route B is the same idea in reverse: each pass adds 3 to the big jug, and an empty takes 5 away. The amounts in the big jug go 3, then 1, then 4. Both routes reach every amount; they simply visit them in a different order.
How do you find the fewest moves?
Finding the fewest moves is a hard question in general. For the sliding 15-puzzle grown to boards of any size it was known by 2015 to be NP-hard [1]. A simple routine that always finishes sidesteps that problem. Jug puzzles are small enough to settle by hand.
Run the loop both ways and count. One direction is almost always shorter, and it is usually the one that reaches your target earlier in its pattern. In the example above, the target 4 is the second amount route A shows but the third amount route B shows, so route A wins.
Two small habits make counting reliable:
- Write the state after every move. A two-column table like the ones above stops you losing track.
- Stop as soon as the target appears. You do not need to finish the loop, and you do not need the other jug to be empty unless the puzzle says so.
Also check whether the target needs to be in a particular jug. Getting 4 L in the small jug is a different puzzle from getting 4 L in the big jug, and with a 3 L small jug it is impossible.
What about sharing puzzles with three jugs?
Another kind of jug puzzle gives you three jugs, such as 8 L, 5 L and 3 L, with the biggest jug full and the others empty. There is no tap and no drain, so the only move is pouring. The goal is to share the water into two equal halves.
Measuring puzzles have close cousins in weighing puzzles. A classic one asks you to find the one lighter coin among identical-looking coins with a balance scale in the fewest weighings, and it first appeared in 1945 [2].
The same thinking applies to sharing puzzles. Every pour runs until a jug is empty or full, and you track the state after every move. The extra rule is that water never leaves the system, so the three amounts always add up to the same total. That makes a handy check: if your three numbers do not add up to 8 after a move, you have made a mistake.
A useful approach is to run the loop method with the middle jug as the pourer and the biggest jug acting as both tap and drain. Keep pouring the middle jug into the smallest one. When the smallest jug is full, empty it back into the biggest jug. When the middle jug is empty, refill it from the biggest jug. With 8 L, 5 L and 3 L jugs, this routine splits the water into two equal halves in 7 pours.
How can you work backwards from the target?
If the loop feels slow, start from the end. Ask what the jugs must look like one move before the target appears. For 4 L in a 5 L jug next to a 3 L jug, a good last move is a pour from a full 5 L jug into a 3 L jug that already holds 2 L, because that pour moves exactly 1 L and leaves 4 L behind. So the question becomes: how do you get 2 L into the small jug? That part is easy: fill the 5 L jug, pour it into the small jug, and the 2 L left over can be moved across once the small jug is emptied.
Working backwards like this often shows the short route at once, and it explains why route A won in the example above. It is also a good way to check a route you found with the loop: if every step makes sense when you read it backwards, the route is sound.
What mistakes should you avoid?
- Stopping a pour halfway. A pour always runs until one jug is full or the other is empty.
- Forgetting to count every move. Filling and emptying are moves too, not just pouring.
- Trying only one direction. The second route can be much shorter.
- Chasing an impossible target. Check the shared divisor before you start.
- Losing track of the state. Write both amounts after every move, every time.
Practice puzzles: can you solve these?
Use the loop method on each puzzle below. Decide which jug to use as the pourer, write a state table, and count your moves. Then try the other direction and see which is shorter before you check the answers.
- You have a 4 L jug and a 9 L jug. Get exactly 6 L in the 9 L jug. Filling, emptying and pouring each count as one move.
- You have a 5 L jug and a 7 L jug. Get exactly 6 L in the 7 L jug, with the same moves.
- An 8 L jug is full, and a 5 L jug and a 3 L jug are empty. There is no tap and no drain. Share the water into 4 L and 4 L using pours only.
Answers
- 8 moves, with the 9 L jug as the pourer.
- 10 moves, with the 7 L jug as the pourer.
- 7 pours, using the middle jug as the pourer as described above.
If your count is higher, write out the other direction and compare. For two-jug puzzles like these, the shortest route is one of the two loops.
References
- Parberry, I. (2015, July 10). Solving the (n² − 1)-Puzzle with 8/3 n³ Expected Moves. Algorithms, 8(3), 459-465. DOI 10.3390/a8030459
- Khovanova, T., & Knop, K. (2025, June 26). Coins that Change Their Weights. Recreational Mathematics Magazine, 12(20), 65-101. DOI 10.2478/rmm-2025-0005