What Is Birthday Paradox?
The birthday paradox is the surprising fact that a small group already has a good chance of a shared birthday. The probability that all n birthdays are different is the product (d/d) × ((d − 1)/d) × … × ((d − n + 1)/d) with d possible days, and the chance of at least one match is 1 minus that.
The calculator reports the probability for your group size, the number of pairs of people, the expected number of matching pairs, and the group size needed for 50 % and 99 %. It also shows a quick exponential approximation. Set d to a different number to model other situations, such as matching hash values.
Below you will find the formulas, a variables table, a worked example and answers to common questions such as why the answer feels counter-intuitive.
How to Use the Birthday Paradox Calculator
- Enter the number of people in the group.
- Leave the number of possible values at 365, or change it for other collision problems.
- Set a target probability to see the group size needed to reach it.
- Read the exact probability, the pairs count and the curve. Use the table for a quick lookup.
Birthday Paradox Formula
Probability that all n birthdays differ
Probability of at least one match
Approximation
Group size for 50% (rule of thumb)
Birthday Paradox Variables Explained
| Symbol | Meaning | Notes |
|---|---|---|
| n | Number of people | |
| d | Number of possible days (or values) | 365 by default |
| P(all differ) | No shared birthday | Product of falling fractions |
| P(match) | At least one shared birthday | 1 − P(all differ) |
| n(n − 1)/2 | Number of pairs |
Birthday Paradox Worked Example
Using the example values (press “Load example” above to try them):
- Probability that all 23 people have different birthdays = (365/365) × (364/365) × … × (343/365) = 0.49270277.
- So P(at least one shared birthday) = 1 − 0.49270277 = 0.50729723.
- Searching n upward, the smallest group with probability at least 90% is n = 41.
Result: Chance at least two of 23 share a birthday = 0.5072972; People needed for a 90% chance = 41.
Why does it work with so few people?
The number of pairs grows with the square of the group. With n people there are n(n − 1)/2 pairs. Ten people have 45 pairs, 23 have 253, and 50 have 1,225. Each pair has a small chance of matching, but with hundreds of pairs those small chances add up quickly.
It is also easier to compute the chance that everyone has a different birthday and subtract from 1. The second person avoids the first person’s birthday with probability 364/365, the third avoids both with 363/365, and so on; multiplying these gives the chance of no match.
| People | Pairs | Probability of a match |
|---|---|---|
| 10 | 45 | 11.7% |
| 20 | 190 | 41.1% |
| 23 | 253 | 50.7% |
| 30 | 435 | 70.6% |
| 40 | 780 | 89.1% |
| 50 | 1,225 | 97.0% |
| 70 | 2,415 | 99.92% |
Assumptions and real-world differences
- Birthdays are uniformly spread over 365 days. In reality there are seasonal patterns, which make a match slightly more likely.
- February 29 is ignored. Using 366 changes the numbers only slightly.
- People are unrelated: twins or family members would increase the chance of a match.
- The question is about any pair sharing a birthday, not about sharing a particular person’s birthday. The chance someone matches your birthday needs about 253 people for 50%.
The same maths in computing and security
The birthday problem describes collisions: two items landing in the same bucket. In computing it explains why hash functions need many more bits than you might expect. A hash with d possible outputs starts producing collisions after about √d items, which is why a 128-bit hash gives only about 64 bits of collision resistance. Cryptographic “birthday attacks” exploit this. Change the “possible values” input to 2^32 = 4,294,967,296 to see that around 77,000 random 32-bit IDs already have a 50% chance of a collision.
Where Birthday Paradox Is Used
Probability teaching
Showing a counter-intuitive result with exact numbers.
Collision estimates
Estimating the chance of repeated values when d possible values are drawn at random.
Group planning
Finding how many people make a shared birthday likely.
Checking the approximation
Comparing the exact value with the exponential estimate.
Common Birthday Paradox Mistakes to Avoid
- To match a specific date, not any pair, use the “at least once” probability with p = 1/365 instead.
- For large d, the square-root rule n ≈ 1.18√d gives the 50% point.
- The curve is S-shaped: it moves slowly at first, then quickly, then flattens.
Birthday Paradox Terms and Definitions
- Collision
- Two items mapping to the same value.
- Pair
- A combination of two people; there are n(n − 1)/2 in a group of n.
Birthday Paradox FAQs
What is the birthday paradox?
The counter-intuitive fact that in a group of only 23 people there is about a 50.7% chance that two share a birthday.
How many people do you need for a 99% chance?
57 people give about 99% chance. With 70, the chance is over 99.9%.
Is it really a paradox?
No. It is only surprising because we compare with a single person’s birthday, while the question involves every pair in the group.
What is the chance someone shares my birthday?
That is a different problem. You would need about 253 people for a 50% chance, because only comparisons with your own date count.
How is it used in cryptography?
Birthday attacks look for hash collisions in about √d tries rather than d. That is why hash outputs need to be long.
Does leap day change the result?
Slightly. With 366 days the group size for 50% is still 23, and the probabilities differ only in the third decimal place.
Can I use a number of days other than 365?
Yes. Enter any number of possible values to model other collision problems.