The 100 Hats Puzzle: How One Bit of Information Saves 99 People

The 100 Hats Puzzle: How One Bit of Information Saves 99 People

One hundred people wear red or blue hats. Each can see the hats ahead, but not their own, and each must say their hat color aloud. It sounds like a guessing game. Yet, if they agree on a plan first, 99 people can give the right answer with certainty. The secret is a single piece of information: whether a count is even or odd.

A Line of Hats and a Difficult Choice

Picture 100 people standing in a line, all facing forward. The person at the back sees 99 hats. The person at the very front sees none. Nobody can see their own hat or turn around.

Starting at the back, each person must say exactly one word: “red” or “blue.” Everyone hears the answers spoken before their turn. They may agree on a strategy before the hats are placed, but once the challenge begins, they cannot add explanations, gestures, or secret signals.

The goal is to guarantee as many correct answers as possible, no matter how the hats are arranged. That last detail matters. A plan that usually works is impressive; a plan that works even with the most troublesome arrangement is better.

Take a moment to consider the first speaker. They can see almost the entire line, but their own hat is a complete mystery. What could they say that would help everyone else?

When a puzzle limits what you can say, ask what useful fact you could encode in the answers you are allowed to give.

Why Naming One Hat Is Not Enough

The person at the back could call out the color of the hat immediately ahead. That would let the next person answer correctly. But then the third person would need help, too. The group could repeat this in pairs, guaranteeing 50 correct answers, but it would waste much of what the first speaker can see.

The better question is not “Which hat should I describe?” It is “What single fact about all the hats ahead would stay useful as the answers move down the line?”

The answer is parity: whether the number of red hats is even or odd. Zero, two, and four are even; one, three, and five are odd. You do not need the exact count to know its parity.

That simple distinction is the same kind of even-and-odd thinking explored in Puzzles Arcade’s guide to parity in puzzles. Here, though, parity is not used to show that a move is impossible. It becomes a message that helps reveal a missing hat color.

The One-Word Plan

Before the hats go on, the group agrees to this code:

  • “Red” from the first speaker means they see an even number of red hats among the other 99 people.
  • “Blue” from the first speaker means they see an odd number of red hats among the other 99 people.

They could swap the words and the plan would still work. What matters is that everyone remembers the same code.

Suppose the first speaker sees 47 red hats. Because 47 is odd, they say “blue.” That word might match their own hat—or it might not. They have no way to tell. For everyone else, however, it announces a dependable fact: the total number of red hats among the 99 people ahead is odd.

Now the second speaker looks at the 98 hats they can see. If they count an even number of red hats, their own hat must be red; adding one red hat makes the announced total odd. If they count an odd number, their own hat must be blue, leaving that total odd.

The second speaker gives their actual hat color. That answer is useful to everyone farther forward: although they can no longer see this person’s hat, they have heard its color correctly.

Watch the Strategy Work With Five People

A smaller line makes the idea easier to follow. Call the people A, B, C, D, and E, with A at the back speaking first. From B to E, the hats are:

Red, blue, red, red.

A sees three red hats, an odd number, so A says “blue.” This is the agreed signal for odd parity. We do not need to know A’s actual hat color to follow the rest of the solution.

B sees C’s blue hat and the two red hats on D and E. That is two visible red hats—an even number. The total for B through E must be odd, so B’s own hat is red. B says “red.”

C has heard B correctly identify a red hat. C can also see the red hats on D and E. That accounts for three red hats already, matching the odd total A announced. C’s hat must therefore be blue.

D has heard that B is red and C is blue, and can see E’s red hat. That accounts for two red hats. To reach an odd total, D’s hat must be red. Finally, E has heard all the correct answers before their turn. B and D are red; C is blue. Two is even, so E’s hat must be red to make the total odd.

Every person after A has identified their hat without guessing. A’s opening answer might also have been right, but the plan does not depend on it.

Try a three- or five-person version on paper: mark the first speaker’s word as the parity signal, not as a confirmed hat color.

Why the Clue Keeps Working All the Way to the Front

The five-person example follows the same rule as the 100-person puzzle. On each turn, the current speaker has three pieces of information:

  1. The even-or-odd total announced at the start.
  2. The correct hat colors spoken by the people who answered after that announcement.
  3. The hats they can see ahead.

Together, the known colors account for every hat in the original group of 99 except the current speaker’s own. If the known red hats have the same parity as the announced total, the missing hat is blue. If the parity differs, the missing hat is red.

Even the person at the front can answer. They see no hats, but by then they have heard the correct colors of the other 98 people in the announced group. The original parity supplies the final missing piece.

This is why the first speaker shares a relationship among all 99 hats rather than naming a single hat. Each correct answer fills in one more part of that relationship. If you enjoy puzzles where a tiny amount of information must be used carefully, Puzzles Arcade’s 12-coin challenge offers another satisfying example.

Why the Guarantee Stops at 99

Could an even cleverer code guarantee all 100 correct answers? No—not under these rules.

Imagine two arrangements that differ only in the first speaker’s hat. In both arrangements, that person sees the same 99 hats. They hear the same things before speaking: nothing. They must therefore make the same opening answer in both arrangements. Since their own hat is red in one arrangement and blue in the other, that answer must be wrong in one of them.

So 100 correct answers cannot be guaranteed. The parity plan reaches the best possible guarantee: 99 correct answers in every arrangement. If the first speaker’s hat is chosen independently with an equal chance of red or blue, they also have a 50% chance of being right, making 100 correct answers possible—but never certain.

To test whether a puzzle strategy is truly guaranteed, change one hidden detail while keeping everything a player can see and hear exactly the same.

The Bigger Idea Behind the Trick

The opening word carries one bit of information: a choice between two possibilities, even and odd. That sounds too small to help 99 people. But each later speaker already knows almost everything relevant when their turn arrives. They need only the clue that settles their one missing color.

Parity also appears in computing. CS Unplugged’s parity-card activity shows how extra even-or-odd information can help people find a changed card in a grid. The hats puzzle uses the same basic idea in a different way: the group knows which piece of information is missing—the current person’s hat—and parity reveals its value.

That is the amazing feat of the 100 hats puzzle. The first speaker cannot see their own answer, yet they can give everyone else exactly what they need. One carefully chosen bit turns 99 apparent guesses into 99 deductions.

Share: