The 100 prisoners boxes puzzle answer is a 31% chance of freedom. Every prisoner opens the box with their own number, then follows the number they find, and that chain strategy lifts the odds from almost zero to about 31%.
The 100 prisoners boxes puzzle sounds impossible at first hearing. One hundred prisoners must each find their own number, each prisoner may open only half the boxes, and a single failure dooms the whole group. Yet a simple agreed rule changes the odds completely. This walkthrough gives the rule, a small worked example, and the exact math behind the 31% figure.
The Question
A warden puts the numbers 1 to 100 into 100 boxes, one number per box, shuffled at random. Each prisoner has a number from 1 to 100. The prisoners agree on a plan before the game starts. Then they enter the room one at a time, with no communication between turns, and the boxes are closed again after each prisoner leaves.
- Each prisoner may open up to 50 boxes.
- If a prisoner finds their own number within 50 opens, they leave and the next prisoner enters.
- If every prisoner finds their own number, the whole group goes free.
- If even one prisoner fails, the whole group fails.
At first glance, each prisoner has a 50 in 100 chance. That part is true for one prisoner alone. The trap is to treat 100 prisoners as 100 separate coin flips.
How the 100 Prisoners Boxes Puzzle Works
The winning rule is short. Open the box with your own number on it. Read the number inside that box. Open the box with that number on it. Keep following the numbers until you find your own number or you reach 50 opens.
Here is a small chain to make the rule concrete. Suppose prisoner 7 opens box 7 and finds the number 23. Prisoner 7 then opens box 23 and finds the number 41. Prisoner 7 then opens box 41 and finds the number 7. Prisoner 7 is done in 3 opens, because the chain led back to the start.
That chain is called a cycle. Every shuffled arrangement of numbers breaks into cycles. Box 7 points to 23, box 23 points to 41, and box 41 points back to 7. A prisoner who starts on their own number walks their own cycle from the start, so they find their own number after exactly as many opens as the length of their cycle.
This is why the rule works. A prisoner fails only when their cycle is longer than 50, because then their own number sits more than 50 steps along the chain. A prisoner succeeds whenever their cycle has 50 links or fewer. And every prisoner on the same cycle shares the same fate: they all succeed together or they all fail together.
Why the 100 Prisoners Boxes Puzzle Beats Random Searching
Random searching treats each prisoner as independent, and independence is what kills the group. Each prisoner still has a 1 in 2 chance alone, but all 100 must succeed at once. The random chance is (1/2) raised to the power 100, which is about 0.0000000000000000000000000000008. For practical purposes, that is zero.
The chain rule links the outcomes instead of leaving them separate. Now the group succeeds whenever no cycle in the shuffle is longer than 50. For a random shuffle, the chance that a cycle of a particular long length exists follows a clean pattern: for each length from 51 to 100, that chance is 1 divided by the length. Add those chances together and the failure chance is about 0.688. Subtract from 1 and the success chance is about 0.312, or roughly 31%.
| Strategy | Chance all 100 succeed |
|---|---|
| Open 50 boxes at random | About 0.0000000000000000000000000000008 |
| Follow the number chain | About 31% |
A smaller version shows the same effect. With 10 prisoners and 5 opens each, the failure chance is 1/6 + 1/7 + 1/8 + 1/9 + 1/10, which is about 0.646. The success chance is about 0.354, or roughly 35%. The pattern holds at every size: the chain rule turns a near impossible task into a roughly one in three shot.
The Trap Most Candidates Fall Into
The most common wrong answer is to stop at the single prisoner odds. A candidate says each prisoner has a 50% chance, so the group must have a decent chance too, and moves on. That misses the whole puzzle. The question is not whether one prisoner can succeed. The question is whether all 100 can succeed at once, and that is where random searching collapses.
The second trap is to change the plan halfway through. A candidate opens their own box, finds a number, and then opens a box they feel good about instead of the box with the number they just found. That breaks the cycle. The chain only guarantees success when every prisoner follows it from their own number without deviation.
The third trap is to assume the boxes must be opened in a clever order that somehow beats the shuffle. No order beats a random shuffle box by box. The chain rule does not beat the shuffle. It uses the structure of the shuffle itself, and that structure is what random searching ignores.
What the Interviewer Is Testing in the 100 Prisoners Boxes Puzzle
An interviewer who asks this puzzle is testing structure over brute force. The brute force answer opens boxes and hopes. The structured answer notices that the numbers form cycles, and that a single shared rule can link 100 separate fates into one condition: no cycle longer than 50.
The interviewer is also testing whether you can explain a counterintuitive result calmly. A jump from almost zero to 31% sounds wrong until you see the cycle argument. A strong candidate states the rule first, walks a short chain on the board, and then explains why the longest cycle decides everything. A weak candidate argues about the 50% figure and never reaches cycles at all.
If you get a follow up, expect it to be about the longest cycle. What happens when one cycle has 68 links? Every prisoner on that cycle fails, because each of them needs 68 opens and only has 50. What happens when the longest cycle has exactly 50 links? Every prisoner succeeds, because 50 opens is exactly enough. Those two cases show you understand the rule, not just the headline number.
Try This Next
If you enjoyed this puzzle, try the Prisoners Hats Puzzle Answer: 99 Survive, where one spoken word saves 99 out of 100 prisoners. Then try the Blue Eyed Islanders Puzzle, where 100 islanders all leave on night 100 for a reason that takes careful induction to see. For another 100 prisoner puzzle with a completely different trick, see the 100 Prisoners and 1 Light Bulb Puzzle.
Can the prisoners talk during the game?
No. They agree on the chain rule before the game starts, and after that they cannot communicate. The rule works without communication because every prisoner follows the same rule from their own number.
What if a cycle is longer than 50?
Then every prisoner on that cycle fails, and the group fails with them. That is the only way the chain strategy loses. The chance of that happening is about 69%, which is why the success chance is about 31% and not 100%.
Why 31% and not 50%?
Because success needs every cycle to be short, not just one prisoner to be lucky. The 50% figure describes one prisoner alone. The 31% figure describes all 100 prisoners together under the chain rule, and it comes from adding the chances of each long cycle length from 51 to 100.
Does the numbering of the boxes matter?
The box numbers are just labels the prisoners agree on before the game. What matters is the shuffle inside the boxes, because the shuffle decides the cycles. Any fixed labeling works, as long as every prisoner uses the same labels.

Lauren Brooks is a finance professional writing on professional exams, study strategies, and finance careers.
Leave a Reply