In a room of just 23 people there is a better than even chance that two of them have the same birthday. That surprises almost everyone, because 23 is so much smaller than 365. The trick is that the question is about any pair of people, not about one particular person: 23 people form 253 different pairs, and each pair is a fresh chance for a match.
The calculation is easiest done backwards. Work out the probability that everyone’s birthday is different (the second person avoids one taken day, the third avoids two, and so on) and subtract it from one. The result climbs quickly: about 41% for 20 people, 71% for 30, 97% for 50 and 99.9% for 70.
This calculator gives that probability for any group size, the number of pairs, the chance that somebody shares your own birthday (a much smaller number), the expected number of matching pairs and the group size needed to reach the chance you choose. You can count leap years as 365.25 days or use any number of days, which turns it into a general collision calculator for hash codes, lottery numbers or ID numbers.
How to use the Birthday Paradox Calculator
- Number of people in the group
- Days in a year
- Number of possible days / values
- Target chance for “people needed”
Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.
How it works
The tool multiplies the factors (D − i)/D for i = 0 … n − 1, where D is the number of days, and subtracts the product from one. Group sizes for a target probability are found by increasing n until the shared-birthday chance reaches the target. The chart plots the probability against group size with your group marked.
Worked example
For 5 people: P(all different) = 365/365 × 364/365 × 363/365 × 362/365 × 361/365 ≈ 0.97286, so the chance of a shared birthday is about 2.71%. For 23 people the product falls to 0.49270 and the chance of a match rises to 50.73%. There are 23 × 22 / 2 = 253 pairs and the expected number of matching pairs is 253 / 365 ≈ 0.69.
Shared-birthday chance by group size
| People | Pairs | Chance of a shared birthday | Someone shares your birthday |
|---|---|---|---|
| 10 | 45 | 11.69% | 2.44% |
| 20 | 190 | 41.14% | 5.08% |
| 23 | 253 | 50.73% | 5.86% |
| 30 | 435 | 70.63% | 7.65% |
| 40 | 780 | 89.12% | 10.15% |
| 50 | 1,225 | 97.04% | 12.58% |
| 57 | 1,596 | 99.01% | 14.24% |
| 70 | 2,415 | 99.92% | 17.25% |
Formula
P(no shared birthday) = 365/365 × 364/365 × … × (365 − n + 1)/365 = 365! ÷ ((365 − n)! × 365ⁿ) · P(shared) = 1 − P(no shared) · pairs = n(n − 1)/2
Worked example
Inputs: Number of people in the group: 23; Days in a year: 365 days (ignore 29 February); Target chance for "people needed": 50 %.
Results: Chance that at least two people share a birthday = 50.7297 %; As odds = 1 in 1.97; Chance that all birthdays are different = 49.2703 %; Number of pairs of people = 253; Chance someone shares YOUR birthday = 5.8571 %; Expected number of pairs with the same birthday = 0.6932.
Key terms
- Birthday problem
- Finding the probability that at least two of n people share a birthday.
- Complement rule
- P(at least one match) = 1 − P(no match).
- Pigeonhole principle
- If more items than boxes are placed into boxes, some box gets two items, so 366 people guarantee a shared birthday.
- Collision
- Two items in a random sample that receive the same value.
Frequently asked questions
How many people do you need for a 50% chance of a shared birthday?
23 people give 50.73%. With 22 people the chance is 47.57%.
How many people for 99%?
57 people give 99.01%, and 70 people give 99.92%.
When is a shared birthday certain?
With 366 people if you ignore 29 February (pigeonhole principle), or 367 if leap days are allowed.
What is the chance someone shares my own birthday?
Much lower: with 23 people it is 1 − (364/365)²² ≈ 5.86%. You need 253 other people for a 50% chance.
Why is it called a paradox?
It is not a logical contradiction, just a result that clashes with intuition (a so-called veridical paradox). People compare 23 with 365 instead of counting the 253 pairs.
Does the uneven spread of real birthdays matter?
Slightly. Births are more common in some months, which makes a match a little more likely than the calculator shows, so the figures are a lower bound.
Where else is the birthday problem used?
In cryptography (birthday attacks on hash functions), checking ID numbers for collisions and estimating duplicate entries in random samples.