Birthday Paradox Calculator
Calculate the exact uniform birthday-collision probability for a group, or solve the reverse problem to find the smallest group reaching a target probability. Compare any-pair matching with one specified person's birthday, inspect possible pairs and expected matching pairs, view the probability curve, and generalize the model to other equally likely outcome spaces.
Additional
Use 365 for the classic birthday problem. This generalized model assumes every outcome is equally likely.
Supported range: 1 to 100,000 equally likely outcomes. The calculator does not model custom non-uniform birthday distributions.
How to use the Birthday Paradox Calculator
Choose Shared-birthday probability when you know the group size. Enter the number of people and the calculator finds the chance that at least one pair shares a birthday.
Choose Group size for a target probability when you know the probability you want. The calculator finds the smallest whole-number group that reaches or exceeds that target.
The classic birthday problem uses 365 equally likely outcomes. A custom number of possible birthdays or outcomes is available under Additional.
The result also shows the probability curve, possible pair comparisons, expected matching pairs, common thresholds, and the chance that someone matches one specified person's birthday.
Why 23 people is enough for a 50% chance
The birthday paradox feels surprising because people often imagine one person being compared with everyone else.
The classic problem does something much larger: it considers every possible pair in the group.
A group of 23 people contains 23 × 22 ÷ 2 = 253 distinct pairs.
Under the uniform 365-day model, those pair opportunities produce a 50.7297% probability that at least one pair shares a birthday.
| People | Possible pairs | Chance of at least one match |
|---|---|---|
| 10 | 45 | 11.6948% |
| 20 | 190 | 41.1438% |
| 23 | 253 | 50.7297% |
| 30 | 435 | 70.6316% |
| 40 | 780 | 89.1232% |
| 41 | 820 | 90.3152% |
| 50 | 1,225 | 97.0374% |
| 57 | 1,596 | 99.0122% |
| 70 | 2,415 | 99.916% |
How the exact birthday probability is calculated
It is easier to calculate the probability that every birthday is different and then subtract that value from one.
The first person can have any birthday. The second must avoid one occupied day, the third must avoid two occupied days, and so on.
For n people and d equally likely birthdays, the no-match probability is the product of (d − i) ÷ d for i from zero through n − 1.
The shared-birthday probability is one minus that no-match probability.
If n becomes greater than d, at least two people must share an outcome by the pigeonhole principle.
Any pair matching is not the same as someone matching you
This distinction is the main reason the birthday paradox feels counterintuitive.
With 23 people, the classic question compares 253 different pairs.
If instead one particular person is fixed, only the other 22 people can match that person's birthday.
Under the same 365-day uniform model, the any-pair probability is about 50.7297%, while the probability that one of the other 22 people matches one specified person's birthday is only about 5.8571%.
| Question | Comparisons | Method | 23-person example |
|---|---|---|---|
| Any pair matches | n(n − 1) / 2 | Classic birthday paradox | 23 people → 50.7297% |
| Someone matches one specified person | n − 1 | 1 − ((d − 1) / d)^(n − 1) | 23 people → about 5.8571% |
Find how many people are needed for a target probability
The calculator can solve the birthday problem in reverse.
Enter a target such as 75%, 95%, or any other probability greater than 0% and less than 100%.
The result is the smallest whole-number group whose exact collision probability reaches or exceeds that target.
The breakdown also shows the previous group size so you can verify that the threshold has actually been crossed.
| Target | Minimum people | Probability reached | Previous group |
|---|---|---|---|
| 50% or higher | 23 | 50.7297% | 22 people: 47.5695% |
| 75% or higher | 32 | 75.3348% | 31 people: 73.0455% |
| 90% or higher | 41 | 90.3152% | 40 people: 89.1232% |
| 95% or higher | 47 | 95.4774% | 46 people: 94.8253% |
| 99% or higher | 57 | 99.0122% | 56 people: 98.8332% |
Understanding the probability curve
The curve plots exact collision probability against group size.
At small group sizes the probability rises slowly, but the number of distinct pairs grows quadratically as more people are added.
The current group is marked on the curve, and target mode also shows the selected probability level.
The curve is not generated from random simulation. It visualizes values from the exact uniform model.
Why the number of pairs grows so quickly
A group of n people contains n(n − 1)/2 distinct pairs.
Adding one new person creates a new comparison with every person already in the group.
That means the number of pair opportunities grows much faster than the number of people.
For example, 10 people produce only 45 pairs, while 50 people produce 1,225.
Expected matching pairs is not a probability
Every pair has probability 1/d of matching under a uniform d-outcome model.
Multiplying that probability by the number of distinct pairs gives the expected number of matching pairs.
Expected matching pairs can exceed one because a single group may contain several matching pairs.
It should not be interpreted as the probability that a match occurs.
Probability thresholds for the classic 365-day model
The familiar 50% threshold occurs at 23 people.
The probability exceeds 75% at 32 people, 90% at 41, 95% at 47, and 99% at 57.
These values are minimum whole-number group sizes, not approximations from the common square-root formula.
When the number of possible outcomes changes, the calculator recomputes threshold sizes for that outcome space.
Use the model for other collision problems
The birthday problem is a general collision problem rather than mathematics that applies only to calendars.
The same exact model works whenever independent items are assigned uniformly to a fixed number of possible outcomes.
Examples include simplified hash-output collisions, random identifiers, numbered bins, or repeated random selections.
The model is not valid when outcomes have unequal probabilities unless the underlying calculation is changed.
Classic birthday-model assumptions
The standard birthday problem assumes 365 equally likely birthdays, independent people, no leap day, and no relationship among births.
Those assumptions make the collision probability exactly calculable and are useful for teaching probability.
Real populations contain seasonal birth patterns, scheduled deliveries, twins, leap-day births, and other departures from the idealized model.
The calculator therefore distinguishes the mathematical birthday model from a demographic model of real birth dates.
| Assumption | Meaning | Real-world limitation |
|---|---|---|
| Equal probability | Every possible birthday or outcome has probability 1/d | Real birth dates are not distributed perfectly evenly |
| Independence | One person's birthday does not affect another person's birthday | Twins, related births, and selected populations can violate this assumption |
| Fixed outcome count | The classic model normally uses 365 possible birthdays | Leap day and other calendar conventions require a different model |
| Any matching pair | A collision occurs when any two people share a birthday | This is not the probability that someone matches one specified person's birthday |
Should you use 365 or 366 birthdays?
Use 365 for the classic birthday paradox.
Entering 366 treats every one of 366 days as equally likely, including February 29.
That is a mathematical 366-outcome model, not a realistic model of leap-day frequency.
A real calendar-based distribution would require unequal probabilities and year-specific assumptions that this calculator intentionally does not model.
Why it is called a paradox
There is no logical contradiction in the birthday paradox.
The name comes from the gap between the mathematical result and common intuition.
People tend to think about one birthday being matched rather than hundreds of possible pair comparisons.
Once those pair comparisons are made visible, the rapid rise in probability becomes much easier to understand.
Numerical precision
Directly multiplying many probabilities close to one can lose numerical precision.
The calculator instead accumulates logarithms of the no-collision terms.
It uses Math.expm1 when converting the logarithmic result back to collision probability so very small probabilities are not unnecessarily rounded to zero.
Displayed probabilities are rounded for readability while the calculation retains normal JavaScript floating-point precision.
What the results mean
The calculator reports several related quantities because no single number explains the birthday problem completely.
The collision probability answers whether at least one pair matches.
The specified-person probability answers a different question: whether anyone else matches one chosen person's birthday.
Pair count explains how many opportunities exist, expected matching pairs describes an average count, and the curve shows how the collision probability changes with group size.
| Result | Meaning |
|---|---|
| Shared-birthday probability | Chance that at least one pair in the group shares an outcome |
| No-shared-birthday probability | Chance that every person receives a different outcome |
| Specific-person match probability | Chance that at least one other person matches one chosen person's birthday |
| Pair comparisons | Number of distinct pairs in the group |
| Expected matching pairs | Average number of matching pairs across many equivalent groups |
| Probability curve | How collision probability changes as group size increases |
| Target group size | Smallest whole-number group reaching a selected probability |
Birthday collision probability formulas
The calculator uses the exact uniform-outcome model for forward probability and reverse threshold solving. The common square-root expression is useful as an approximation but is not used for the final threshold result.
- Number of people or sampled items
- Number of equally likely possible birthdays or outcomes
- Target collision probability
- Number of matching pairs
Examples
Classic 23-person group
23 people and 365 possible birthdays
50.7297% chance of at least one shared birthday, 49.2703% chance of no shared birthday, and 253 possible pairs.
Someone matching one specified person's birthday
23 total people and 365 possible birthdays
The chance that at least one of the other 22 people matches one specified person's birthday is about 5.8571%.
This is much lower than the 50.7297% probability that any pair in the group matches.
Find the 50% threshold
Target probability = 50%; 365 possible birthdays
23 people are required. With 22 people the probability is about 47.5695%; with 23 it is about 50.7297%.
Find the 75% threshold
Target probability = 75%; 365 possible birthdays
32 people are required, producing about a 75.3348% probability.
Find the 95% threshold
Target probability = 95%; 365 possible birthdays
47 people are required, producing about a 95.4774% probability.
Ten-person group
10 people and 365 possible birthdays
11.6948% chance of at least one shared birthday.
Small custom outcome space
5 people and 10 equally likely outcomes
69.76% chance of at least one collision.
Guaranteed match
366 people and 365 possible birthdays
100% probability. At least two people must share an outcome by the pigeonhole principle.
Frequently Asked Questions
What is the birthday paradox?
It is the surprising result that only 23 people are needed for the probability of at least one shared birthday to exceed 50% under the classic 365-day uniform model.
What is the probability with 23 people?
With 365 independent and equally likely birthdays, the probability that at least one pair matches is approximately 50.7297%.
Why are 23 people enough?
Because 23 people create 253 distinct pairs, and any one of those pairs can produce the match.
Does a 50% birthday paradox mean someone probably shares my birthday?
No. With 23 total people, the chance that one of the other 22 people matches one specified person's birthday is only about 5.8571% under the same uniform model.
Can I find how many people are needed for any target probability?
Yes. Choose the target-probability mode and enter a percentage greater than 0 and less than 100. The calculator returns the smallest whole-number group that reaches it.
How many people are needed for a 50% chance?
With 365 equally likely birthdays, 23 people are required.
How many people are needed for a 75% chance?
With 365 equally likely birthdays, 32 people are required.
How many people are needed for a 90% chance?
With 365 equally likely birthdays, 41 people produce approximately a 90.3152% probability.
How many people are needed for a 95% chance?
With 365 equally likely birthdays, 47 people produce approximately a 95.4774% probability.
How many people are needed for a 99% chance?
With 365 equally likely birthdays, 57 people produce approximately a 99.0122% probability.
What does the probability curve show?
It shows how the exact any-pair collision probability changes as group size increases.
Is the graph based on simulation?
No. It plots probabilities calculated from the exact uniform collision model.
What happens when there are more people than possible birthdays?
A match is guaranteed by the pigeonhole principle.
Can the probability be almost 100% without being guaranteed?
Yes. The probability can be extremely close to 100% before certainty is forced. Guaranteed collision occurs when the number of people exceeds the number of possible outcomes.
Why does the calculator show expected matching pairs?
It shows how many matching pairs occur on average across many equivalent groups. It is not the same as the probability of at least one match.
Can expected matching pairs be greater than one?
Yes. A group can contain several matching pairs, so the expected count can exceed one.
Should I use 365 or 366 possible birthdays?
Use 365 for the classic birthday paradox. A 366 setting treats leap day as another equally likely outcome, which is a mathematical model rather than a realistic birth-date distribution.
Are real birthdays equally distributed?
No. The classic model is idealized. Real birth frequencies vary across dates and populations.
Can this model hash collisions?
It can model a simplified uniform collision space when outputs are treated as independent and equally likely. Real cryptographic analysis also depends on hash design, output length, attacker capabilities, and other assumptions.
Why use logarithms in the calculation?
Multiplying many probabilities close to one can lose numerical precision. Summing logarithms is more stable for large groups.
Why use Math.expm1?
It computes exp(x) − 1 accurately when x is close to zero, which helps preserve very small collision probabilities.
Can I enter decimal people or outcomes?
No. Group size and number of possible outcomes must be whole numbers.
Can I use a custom number of outcomes?
Yes. Open Additional and enter the number of equally likely possible outcomes.
Can I model unequal birthday probabilities?
No. This calculator assumes a uniform outcome distribution.