Birthday Paradox Calculator

Birthday Paradox Calculator

Find the chance that two people in a group share a birthday, or that someone shares yours, and the group size needed to reach any probability. Works for any number of equally likely days.

P(shared) = 1 − (365 × 364 × … × (366 − n)) ÷ 365ⁿ

Enter the number of people

What Is the Birthday Paradox?

The birthday paradox is the surprising fact that in a group of just 23 people, there's a better than even chance that two of them share a birthday. It isn't a true paradox, just a result that clashes with intuition.

The intuition goes wrong because it pictures one person looking for a match among the others. In fact every pair is a chance for a match, and 23 people form 253 pairs. Each pair has only a 1-in-365 chance, but 253 chances add up quickly.

The same maths matters well beyond parties. It explains why hash codes and random IDs collide sooner than expected. It's also the basis of "birthday attacks" on cryptographic hashes, which need only about the square root of the number of possible values to find a clash.

Birthday Paradox Formula

As given in Feller, An Introduction to Probability Theory and Its Applications, vol. 1, chapter 2. See Sources.

1. Chance nobody matches

P(no match) = (d ÷ d) × ((d − 1) ÷ d) × … × ((d − n + 1) ÷ d)

Each new person must avoid every birthday already taken.

2. Chance of at least one match

P(shared) = 1 − P(no match) ≈ 1 − e^(−n(n − 1) ÷ 2d)

3. Someone sharing your birthday

P = 1 − ((d − 1) ÷ d)^(n − 1)

This is the question intuition answers, and it needs a far bigger group: 254 people for a 50% chance.

Worked Example: A Class of 30

Given:
A teacher bets a class of 30 pupils that two of them share a birthday.
Step 1:
Count the pairs:
30 × 29 ÷ 2 = 435 pairs
Step 2:
Chance all 30 birthdays differ:
365/365 × 364/365 × … × 336/365 = 0.2937
Step 3:
Compare with the teacher sharing a pupil's birthday:
1 − (364/365)³⁰ = 7.9%
Result:
70.6% chance of a shared birthday

The teacher wins about 7 times in 10. But a pupil looking for someone with their own birthday has only a 7.6% chance: a different, much rarer event.

Shared Birthday Probability by Group Size

Probability of a shared birthday and of someone sharing yours for several group sizes
PeoplePairsAny two shareSomeone shares yours
104511.7%2.4%
2019041.1%5.1%
2325350.7%5.9%
3043570.6%7.6%
4078089.1%10.1%
50122597%12.6%
57159699%14.2%
70241599.9%17.2%

Common Birthday Paradox Mistakes

  • Answering "does anyone share mine?". That needs 253 others for even odds. The paradox is about any pair.
  • Expecting 183 people for 50%. Half of 365 is the wrong scale. Matches grow with pairs, which grow with n², so about √365 people already give good odds.
  • Adding the pair probabilities. 435 × 1/365 is more than 1. Pairs overlap, so work out the chance of no match and subtract from 1.
  • Worrying about uneven birth rates. Real birthdays aren't perfectly uniform, but that only makes matches slightly more likely.

Birthday Paradox FAQs

How many people for a 50% chance?

23 people give 50.7%. 57 people give over 99%.

Why is it called a paradox?

Because the answer feels impossible, not because it contradicts itself. It’s a veridical paradox: true but counter-intuitive.

What about leap years?

Including 29 February barely changes anything; it lowers the 23-person figure by a fraction of a percentage point.

What does “possible days” do?

It changes the number of equally likely options: 12 for birth months, 7 for weekdays, or a huge number for random IDs.

Can I use this for hash collisions?

Yes. Enter the number of possible hash values as the days, within the limit of 1,000,000, and the number of items as the people.

Why does the approximation use e?

For small probabilities per pair, the chance of no match among n(n − 1)/2 roughly independent pairs is close to e^(−pairs ÷ d).

What about three people sharing?

That’s much rarer: you need 88 people for an even chance of a triple birthday.

Do twins count?

The formula assumes independent birthdays, so twins in the group make a match more likely than calculated.

Sources

  • W. Feller, An Introduction to Probability Theory and Its Applications, vol. 1, 3rd edition (Wiley, 1968), chapter 2.
  • P. Diaconis and F. Mosteller, "Methods for studying coincidences", Journal of the American Statistical Association 84 (1989), doi:10.1080/01621459.1989.10478847: includes the triple-birthday figure.

Related Tools