Probability Calculator
Work out the chance of two events together, one after the other, or over many tries, with every step shown.
https://flxcode.com/probability-calculator/
A decimal, a fraction like 1/6, or a percent.
Example Probability
Probability of A or B (or both) (70%)
| P(A or B), at least one | 0.7 (70%) |
|---|---|
| P(A and B), both | 0.2 (20%) |
| P(A given B) | 0.5 (50%) |
| P(B given A) | 0.4 (40%) |
| P(not A) | 0.5 (50%) |
| P(not B) | 0.6 (60%) |
| P(neither) | 0.3 (30%) |
| P(exactly one) | 0.5 (50%) |
| Independent? | Yes: P(A and B) = P(A) × P(B) |
The steps, with your numbers
Independent events: P(A and B) = P(A) × P(B) = 0.5 × 0.4 = 0.2.
P(A or B) = P(A) + P(B) − P(A and B) = 0.5 + 0.4 − 0.2 = 0.7.
P(A given B) = P(A and B) ÷ P(B) = 0.2 ÷ 0.4 = 0.5.
P(B given A) = P(A and B) ÷ P(A) = 0.2 ÷ 0.5 = 0.4.
Complements: P(not A) = 1 − 0.5 = 0.5, P(not B) = 1 − 0.4 = 0.6.
No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it.
Problem or idea? Email us
Quick start
- For two events, type P(A) and P(B) and say how they relate: independent, mutually exclusive, or a known P(A and B).
- Pick what to show first: A or B, A and B, A given B, or not A. The table lists all of them.
- For repeated tries, switch to Repeated trials and type n, p and k.
Worked examples: two events
| Given | P(A or B) | P(A and B) | P(A given B) |
|---|---|---|---|
| P(A) = 0.5, P(B) = 0.4, independent | 0.7 | 0.2 | 0.5 |
| P(A) = 0.6, P(B) = 0.3, mutually exclusive | 0.9 | 0 | 0 |
| P(A) = 0.7, P(B) = 0.5, P(A and B) = 0.4 | 0.8 | 0.4 | 0.8 |
| Two dice both showing a six (1/6 and 1/6, independent) | 0.305556 | 0.027778 | 0.166667 |
Worked examples: repeated trials
| Situation | Probability | Which |
|---|---|---|
| Coin, 10 flips, exactly 5 heads | 0.246094 | P(X = 5) |
| Coin, 10 flips, 8 or more heads | 0.054688 | P(X ≥ 8) |
| Die, 5 rolls, exactly 2 sixes | 0.160751 | P(X = 2) with p = 1/6 |
| 20 items, 5% defective, at most 1 bad | 0.73584 | P(X ≤ 1) |
| Coin, 100 flips, 60 or more heads | 0.028444 | P(X ≥ 60) |
The rules it uses
| What | Formula |
|---|---|
| A or B | P(A) + P(B) − P(A and B) |
| A and B, independent | P(A) × P(B) |
| A and B, mutually exclusive | 0 |
| A given B | P(A and B) ÷ P(B) |
| Not A | 1 − P(A) |
| Neither | 1 − P(A or B) |
| Exactly k in n tries | C(n, k) × p^k × (1 − p)^(n − k) |
When you give P(A and B) yourself, the tool checks that it is possible. It has to lie between max(0, P(A) + P(B) − 1) and the smaller of P(A) and P(B).
When binomial applies
- There is a fixed number of tries, n.
- Each try has two outcomes, success or not.
- The chance p is the same every time and the tries don't affect each other.
Drawing cards without putting them back fails the last two, so that needs a hypergeometric calculation instead. For how far a result is from the average, use the z-score calculator, and for a probability from a test statistic use the p-value calculator. The standard deviation calculator covers measured data.
Numbers this uses
The calculator has no measured constants. These are its limits.
- Probabilities is between 0 and 1, typed as decimals, fractions or percents. Standard probability axioms.
- Trials is up to 100,000. A limit we set. Terms are summed from logarithms of factorials, accurate to about 12 digits.
- Display is 6 decimals, with the percent beside it. Results below 0.0001 use scientific notation.
Nothing you type is uploaded. We count events without cookies (details).
FAQ
How do I find the probability of A or B?
Add the two and subtract the overlap: P(A or B) = P(A) + P(B) − P(A and B). For independent events with 0.5 and 0.4 the overlap is 0.5 × 0.4 = 0.2, so the result is 0.7. If A and B can't happen together, the overlap is 0 and you just add.
What does independent mean?
Knowing that A happened does not change the chance of B. Two coin flips are independent. Then P(A and B) = P(A) × P(B). The tool checks this for you and says whether your numbers are independent.
What is the difference between independent and mutually exclusive?
Mutually exclusive events can never happen together, so P(A and B) = 0. Independent events can happen together, and the chance of both is the product. Two events that each have a non-zero chance can't be both.
How do I calculate conditional probability?
P(A given B) = P(A and B) ÷ P(B). With P(A and B) = 0.4 and P(B) = 0.5 it is 0.8. Choose "I know P(A and B)" and "A given B" in the tool.
What is a binomial probability?
It is the chance of exactly k successes in n independent tries when each try succeeds with the same probability p. The formula is C(n, k) × p^k × (1 − p)^(n − k). A fair coin flipped 10 times gives exactly 5 heads with probability 0.246094.
How do I find "at least" and "at most" probabilities?
At most k adds up P(X = 0) through P(X = k). At least k is the same sum from k up to n, or 1 minus the at-most figure for k − 1. For 8 or more heads in 10 flips the answer is 0.054688.
Can I type a fraction or a percent?
Yes. For p you can type 0.25, 1/4 or 25%. The tool shows each result as a decimal and as a percent.
Is my input sent anywhere?
No. The numbers stay in your browser. What you type is not put in the address bar, not stored and not counted.
More from FLXCode
Z-Score CalculatorNew
z-score from a value, mean and standard deviation, or from data, with percentile and p-values.
P-Value CalculatorNew
p-value from a z, t, chi-square or F statistic, one or two tailed, with the tails shown.
Standard Deviation CalculatorNew
Paste your numbers and get the sample and population standard deviation, with the steps shown.
Average CalculatorNew
Average (mean) of pasted numbers, or a weighted average for grades and prices, with the steps.