Home › Statistics & Probability › Birthday Problem Calculator
Birthday Problem Calculator
Computes the probability that at least two of n people share a birthday in a year of a given length (365 days by default), the complementary probability that all birthdays differ, the expected number of matching pairs, and the group sizes at which the chance reaches 50 % and 99 %.
When to use
You want the classic birthday-paradox probability for a group, or the same collision probability for any set of equally likely categories (hash values, PINs, tokens).
Do not use when: You want the probability that someone shares a specific person's birthday (that is 1 − (364/365)^(n−1), a different question), or birthdays are far from uniform.
Formula
P(all different) = Π_{i=0}^{people−1} (1 − i/days) = days! / ((days − people)! · days^people); P(shared) = 1 − P(all different); expected pairs = people·(people − 1) / (2·days)
Assumes birthdays are independent and uniformly distributed over the days. With more people than days the probability is exactly 1 (pigeonhole principle). Real birthdays are slightly non-uniform, which raises the probability marginally.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
people | integer | yes | Size of the group. Range: ≥ 1, ≤ 100000 | |
days | integer | default 365 | Number of equally likely birthdays or categories (365 ignores leap days; use 366 to include them). Range: ≥ 1, ≤ 1000000 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
probability_shared | number | 1 − P(all different). | |
probability_shared_percent | number | % | Same probability in percent. |
probability_all_different | number | Π_{i=0}^{n−1} (1 − i/days). | |
expected_matching_pairs | number | C(n, 2) / days: expected number of pairs sharing a birthday. | |
people_for_50_percent | integer | Smallest group with at least a 50 % chance of a shared birthday. | |
people_for_99_percent | integer | Smallest group with at least a 99 % chance. |
Example
23 people: {"people":23} → {"probability_shared":0.507297,"probability_shared_percent":50.73,"probability_all_different":0.492703,"expected_matching_pairs":0.6932,"people_for_50_percent":23,"people_for_99_percent":57}
30 people: {"people":30,"days":365} → {"probability_shared":0.706316,"probability_shared_percent":70.63,"expected_matching_pairs":1.1918}
GET https://tttkmbb.com/api/v1/calculate/birthday-problem?people=23
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/birthday-problem(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/birthday-problem · Markdown: https://tttkmbb.com/statistics/birthday-problem.md · JSON definition: https://tttkmbb.com/statistics/birthday-problem.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="birthday-problem" - OpenAPI operationId:
calculate_birthday_problem_probability - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- Wikipedia – Birthday problem (reference)
- Wolfram MathWorld – Birthday Problem (reference)
FAQ
Why only 23 people for a 50 % chance?
There are C(23, 2) = 253 pairs of people, and each pair has a 1/365 chance of matching; it is the number of pairs, not the number of people, that grows quickly.
What about leap years?
Set days = 366 to include 29 February as an equally likely day; the effect on the probability is tiny (50.63 % instead of 50.73 % for 23 people).
Related calculators
- Probability of Two Events Calculator — Combine probabilities of two events.
- Combinations and Permutations Calculator — Count the pairs C(n, 2) behind the paradox.