St · Statistics & Probability

How to Calculate the Probability of a Shared Birthday

Published By the 9to5Science editorial team

At a glance

  1. 1. Set the assumptions

    Assume birthdays are independent and equally likely on 365 days, with leap day excluded.

  2. 2. Find no matches

    Calculate the probability that every person has a different birthday by multiplying successive remaining-day fractions.

  3. 3. Take the complement

    Subtract the no-match probability from 1 to get the probability of at least one shared birthday.

  4. 4. Check the group size

    For more than 365 people, a shared birthday is guaranteed under the 365-day model.

The probability depends on how many people are in the group. The usual birthday-problem model assumes 365 possible birthdays, excludes February 29, and treats each person’s birthday as independent and equally likely on any day.

Under those assumptions, calculate the probability that everyone has a different birthday, then subtract that probability from 1. This complement method is much simpler than counting every possible way a pair or larger group could match.

The formula

For the first person, any birthday is possible. For the second person to avoid a match, 364 of the 365 dates remain. For the third person, 363 dates remain, and so on.

For nn people, the probability that all birthdays are different is

P(all different)=365365⋅364365⋅363365⋯365−n+1365.P(\text{all different})=\frac{365}{365}\cdot\frac{364}{365}\cdot\frac{363}{365}\cdots\frac{365-n+1}{365}.

Therefore, for 0≤n≤3650\le n\le365,

P(at least one shared birthday)=1−∏k=0n−1365−k365.P(\text{at least one shared birthday})=1-\prod_{k=0}^{n-1}\frac{365-k}{365}.

The equivalent factorial form is

P(at least one shared birthday)=1−365!(365−n)!(365)n.P(\text{at least one shared birthday})=1-\frac{365!}{(365-n)!(365)^n}.

For n=0n=0 or n=1n=1, the probability is 0: there are not enough people for a shared birthday. If n>365n>365, the probability is 1 by the pigeonhole principle, because more than 365 people must occupy at least one of the 365 birthday dates.

Worked example: 23 people

For 23 people, the probability that all birthdays differ is

P(all different)=365365⋅364365⋅363365⋯343365≈0.492703.\begin{aligned} P(\text{all different}) &=\frac{365}{365}\cdot\frac{364}{365}\cdot\frac{363}{365}\cdots\frac{343}{365}\\ &\approx 0.492703. \end{aligned}

So the probability that at least two people share a birthday is

P(match)=1−0.492703≈0.507297.P(\text{match})=1-0.492703\approx0.507297.

That is about 50.7%. The result can feel surprising because the comparison is between every pair of people, not just between each person and one chosen birthday. With 23 people there are (232)=253\binom{23}{2}=253 distinct pairs that could match.

For comparison, with 10 people the no-match probability is

365⋅364⋅363⋯35636510≈0.8831,\frac{365\cdot364\cdot363\cdots356}{365^{10}}\approx0.8831,

so the chance of at least one shared birthday is about 1−0.8831=0.11691-0.8831=0.1169, or 11.7%.

What “at least two” means

“At least two people have the same birthday” means there is one or more matching pairs. It does not mean that exactly one pair matches, nor does it require three people to share a date. The complement calculation includes every outcome with a match: one pair, several separate pairs, or a group of three or more.

If you instead want the chance that exactly one pair shares a birthday and everyone else has a different date, that is a different event and needs a separate count.

Common mistakes

  • Leaving out the group size: The answer cannot be a single probability unless the number of people is specified. Use the formula with the given nn.
  • Counting only one pair: There are many possible pairs in a group. The complement method accounts for all of them at once.
  • Multiplying match probabilities: Pair-match events overlap and are not independent. Multiplying the chance for one pair by the number of pairs does not give the exact probability.
  • Using the wrong number of dates: The standard calculation uses 365 days. Including February 29 changes the model to 366 dates; real birthday frequencies are also not perfectly uniform.

The 365-day result is a useful idealized estimate. If you have actual birthday-frequency data for a population, use those day-specific probabilities instead of assuming every date is equally likely.

References

  1. Sheldon Ross, A First Course in Probability

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.