Probability Calculator

And, or, not and given probabilities for two events, or the chance of at least one success in n tries.

Inputs

These are example values. Change any of them to calculate your own.

Try:
Problem type

Two events: and, or, given. Repeated tries: at least one success.

Probabilities as

How plain numbers are read. 2/5, 40% and 1 in 5 work either way.

For dependent events: enter B’s chance once A has happened, as when drawing without replacement.

Like 2/5, 40% or 1 in 5.

Read as 40% = 0.4

Like 3/10, 30% or 1 in 4.

Read as 30% = 0.3

The chance of B once A has happened, for example 3/51 for a second ace after a first.

Read as 45% = 0.45

Results

P(A or B)

52%

A, B or both happen: 0.52 (1 in 1.92)

P(A and B)
18%both A and B happen
P(A given B)
60%the chance of A once B has happened
P(B given A)
45%the chance of B once A has happened

Note: A and B are dependent

A happening raises the chance of B from 30% to 45%. Assuming independence would give P(A and B) = 12% and P(A or B) = 58%, not 18% and 52%.

How this was calculated

  1. P(A) = 40% = 0.4
  2. P(B) = 30% = 0.3
  3. P(B given A) = 45% = 0.45
  4. P(A and B) = P(A) × P(B given A) = 0.4 × 0.45 = 0.18 = 18%
  5. P(A or B) = P(A) + P(B) − P(A and B) = 0.4 + 0.3 − 0.18 = 0.52 = 52%
Venn diagram of A and B
Venn diagram of A and BVenn diagram: a box for all outcomes, with circles for A and B. A only 22%, both A and B 18%, B only 12%, neither 48%. The shaded part is P(A or B) = 52%. Not drawn to scale.AB22%18%12%Neither: 48%

Not drawn to scale. Shaded: P(A or B).

Every probability for A and B
Probability ofPercentDecimal1 in NFormula
A40%0.41 in 2.5entered
B30%0.31 in 3.33entered
Not A60%0.61 in 1.671 − P(A)
Not B70%0.71 in 1.431 − P(B)
A and B18%0.181 in 5.56P(A) × P(B given A)
A or B52%0.521 in 1.92P(A) + P(B) − P(A and B)
A but not B22%0.221 in 4.55P(A) − P(A and B)
B but not A12%0.121 in 8.33P(B) − P(A and B)
Exactly one34%0.341 in 2.94P(A or B) − P(A and B)
Neither48%0.481 in 2.081 − P(A or B)
A given B60%0.61 in 1.67P(A and B) ÷ P(B)
B given A45%0.451 in 2.22entered
2 × 2 probability table
EventBNot BTotal
A18%22%40%
Not A12%48%60%
Total30%70%100%

Assumptions

  • P(A and B) = P(A) × P(B given A) from the values you entered; nothing is assumed about independence.
  • A and B are two events in the same situation, such as the same weekend or the same deal of cards.
  • Probabilities are exact as entered; results are rounded for display only.
  • The Venn diagram shows which region each number belongs to; it isn’t drawn to scale.

Calculated in your browser. This site doesn't send or store the numbers you enter.

Updated Report a problem with this calculator

What this calculator answers

It answers two kinds of probability question. With two events, it finds the chance that A and B both happen, that at least one happens, that exactly one or neither happens, and the chance of one event once the other has happened. The events can be independent, mutually exclusive, or dependent, with how they overlap given as P(A and B) or P(B given A). With repeated tries, it finds the chance of at least one success in n tries at the same chance each, and how many tries a given chance takes.

How to use it

  • Problem type: two events, or repeated tries.
  • Probabilities as: how plain numbers are read and results shown. With decimals, 0.4 means 0.4. With percent, 40 means 40%. Fractions such as 2/5, entries with a % sign such as 40%, and 1 in 5 mean the same either way. Switching converts the numbers already typed, so 0.4 becomes 40.
  • How A and B are related: independent (the default, and an assumption you should check), mutually exclusive (they can’t both happen), or dependent, where you enter either Probability of A and B or Probability of B given A. The line under the choice explains each one.
  • Probability of A and Probability of B: each between 0 and 1 (0% and 100%).
  • Find: which probability is the headline. Every other one is in the table below it.
  • Chance per try, Number of tries (a whole number up to 1,000,000,000) and, optionally, a Target chance for repeated tries.

Results update as you type. The Try buttons load the cases worked through on this page: two sixes, two aces, a 1 or a 6 on one die, at least one six in 4 rolls, and a 1% chance over 100 tries. To compare two situations, press Save for comparison, change the inputs and save again. The comparison lists the main probabilities in percent, with each change in percentage points. For exactly k, at most k or at least k successes over repeated tries, Continue in the Binomial Distribution Calculator carries the chance per try and the number of tries over.

Probability of A and B (independent and dependent events)

Multiply the chance of A by the chance of B once A has happened:

P(A and B)=P(A)×P(B∣A)P(A \text{ and } B) = P(A) \times P(B \mid A)

For independent events, A happening doesn’t change the chance of B, so P(B∣A)=P(B)P(B \mid A) = P(B) and the rule becomes P(A)×P(B)P(A) \times P(B). For dependent events, use the changed chance. Drawing two aces from a shuffled 52-card deck without putting the first card back:

  1. First card an ace: P(A) = 4/52 = 1/13.
  2. Second card an ace once the first was: 3 aces are left among 51 cards, so P(B given A) = 3/51 = 1/17.
  3. Both aces: 1/13 × 1/17 = 1/221, about 0.00452 (0.452%).

Returning the first card and reshuffling would make the draws independent: 1/13 × 1/13 = 1/169, about 0.00592.

Probability of A or B

Add the two probabilities, then subtract the overlap so that outcomes where both happen are not counted twice:

P(A or B)=P(A)+P(B)−P(A and B)P(A \text{ or } B) = P(A) + P(B) - P(A \text{ and } B)

“Or” includes the outcomes where both happen. For mutually exclusive events the overlap is 0, so the probabilities simply add: rolling a 1 or a 6 with one die is 1/6 + 1/6 = 1/3, about 0.3333.

Conditional probability: P(A given B)

Divide the chance that both happen by the chance of the event you are given:

P(A∣B)=P(A and B)P(B)P(A \mid B) = \frac{P(A \text{ and } B)}{P(B)}

This works only when P(B) is above 0. If B never happens, “the chance of A once B has happened” has no value, and the calculator shows “Not defined” rather than dividing by 0. P(A given B) and P(B given A) are usually different numbers, as the example below shows.

Worked example: rain on Saturday or Sunday

A forecast gives a 40% chance of rain on Saturday (A) and a 30% chance on Sunday (B). Suppose it also says that if Saturday is wet, the chance of rain on Sunday rises to 45% (B given A). What is the chance of rain on at least one day of the weekend?

  1. Rain on both days: P(A and B) = 0.4 × 0.45 = 0.18, or 18%.
  2. Rain on at least one day: P(A or B) = 0.4 + 0.3 − 0.18 = 0.52, or 52%.
  3. No rain at all: P(neither) = 1 − 0.52 = 0.48, or 48%.
  4. Rain on Saturday, given a wet Sunday: P(A given B) = 0.18 ÷ 0.3 = 0.6, or 60%.

Two shortcuts give wrong answers here. Adding 40% + 30% = 70% counts the weekends with rain on both days twice. Treating the days as independent gives 0.4 × 0.3 = 12% for both days and 40% + 30% − 12% = 58% for at least one. That is 6 percentage points too high, because a wet Saturday makes a wet Sunday more likely. The calculator flags this: with these numbers, A raises the chance of B from 30% to 45%, so the events are dependent.

Independent vs. mutually exclusive events

Independent events don’t affect each other’s chances. Mutually exclusive events can’t happen together. They are different ideas. If A and B each have a chance above 0 and can’t both happen, then A happening makes B impossible, so mutually exclusive events are dependent.

PropertyIndependentMutually exclusive
P(A and B)P(A) × P(B)0
P(A or B)P(A) + P(B) − P(A) × P(B)P(A) + P(B)
Knowing A happenedleaves the chance of B as it wasmakes B impossible
Exampletwo dice both showing six: 1/36one die showing a 1 or a 6: 1/3

When you enter P(A and B) or P(B given A), the calculator checks whether your numbers happen to be independent, meaning P(A and B) equals P(A) × P(B), and says so either way.

Probability of at least one success in n tries

Work out the chance that every try fails, then take it away from 1. With a chance pp of success on each of nn independent tries:

P(at least one)=1−(1−p)nP(\text{at least one}) = 1 - (1 - p)^n

The chance of at least one six in 4 rolls of a die is 1 − (5/6)⁴ = 1 − 625/1296 = 671/1296, about 0.5177 (51.77%). The chance of no six at all is 625/1296, about 0.4823. With fractions typed in, the calculator keeps the answer exact.

How many tries for a given chance?

Solve 1−(1−p)n≥t1 - (1 - p)^n \ge t for the number of tries nn, where tt is the chance you want, and round up to a whole try:

n≥ln⁡(1−t)ln⁡(1−p)n \ge \frac{\ln(1 - t)}{\ln(1 - p)}

With a 1% chance per try:

Chance wantedTries neededChance after that many tries
50%6950.02%
90%23090.09%
99%45999.01%

When the ratio is exactly a whole number, computer arithmetic can land a hair above it. With an 8% chance per try and a target of 15.36%, the answer is exactly 2 tries, because 1 − 0.92² = 0.1536. But ln(1 − 0.1536) ÷ ln(1 − 0.08) comes out as 2.0000000000000004 in standard double-precision arithmetic, which rounds up to 3. The calculator checks the answer and the try before it with exact fractions, so it reports 2.

Why some inputs are impossible

Some combinations can’t describe any real situation, so the calculator names the input and says what would work instead of printing a negative probability:

  • P(A and B) can’t be more than P(A) or P(B). Both happen only when each one happens.
  • P(A and B) must be at least P(A) + P(B) − 1. Otherwise P(A or B) would be more than 1. With P(A) = 0.7 and P(B) = 0.6, the events must overlap by at least 0.3.
  • Mutually exclusive events can’t add up to more than 1. With P(A) = 0.7, P(B) can be at most 0.3.
  • P(B given A) can be at most P(B) ÷ P(A). With P(A) = 0.4 and P(B) = 0.3, that is 0.75, because P(A) × P(B given A) can’t be more than P(B).
  • A probability above 1 is refused. If you type 40 while decimals are chosen, the message suggests 40% or switching to percent.

Reading the result

  • The headline is the probability chosen under Find, followed by the other forms: percent or decimal, “1 in N” and, when you typed fractions, the exact fraction.
  • The three tiles show three more of P(A and B), P(A or B), P(A given B) and P(B given A), leaving out the one in the headline.
  • The dependence note appears when you entered P(A and B) or P(B given A), or chose mutually exclusive events. It says whether the events are independent, and what assuming independence would have given.
  • The Venn diagram puts each probability in its region (A only, both, B only, neither) and shades the headline’s region. It isn’t drawn to scale.
  • Every probability for A and B lists all twelve with the formula used. The 2 × 2 probability table crosses A and not A with B and not B; its totals are the single-event chances. Both download as CSV files.
  • For repeated tries, the headline is the chance of at least one success. The tiles add no successes, exactly one, every try succeeding, the average number of successes and the tries for a 50% chance and for 90% (or your target). The chart shows how the chance grows with more tries. Tries needed for a given chance gives the chance after that many tries and with one try fewer, so you can see the target being crossed.

Assumptions and limitations

  • Independence is only used when you choose it. The calculator never applies it silently to events you describe as dependent.
  • Repeated tries assume every try is independent with the same chance. Pity timers in games (a sure drop after a run of misses) and drawing without replacement change the chance from try to try, so the formula doesn’t fit them.
  • It handles two events at a time. Three or more events need more information about how they overlap.
  • The answer is only as good as the probabilities you enter. A forecast’s 40% is itself an estimate.
  • Fractions are carried exactly and results are rounded for display only. Very small probabilities are written in scientific notation (1E-200) rather than rounded to 0.

Common mistakes

  • Adding probabilities of events that can overlap. 40% + 30% = 70% for rain on the weekend double-counts the weekends with rain on both days. The true figure in the example is 52%.
  • Multiplying dependent events as if they were independent. 0.4 × 0.3 = 12% for rain on both days ignores that the days affect each other; with the stated 45%, it is 18%.
  • Multiplying the chance per try by the number of tries. 1% × 100 tries is not 100%; the chance of at least one success is 63.4%. At 200 tries the shortcut would give 200%, which is impossible.
  • Swapping the condition. In the example, P(A given B) is 60% but P(B given A) is 45%. Check which event you are told has happened.
  • Calling mutually exclusive events independent. Events that can’t happen together are dependent, unless one of them has a chance of 0.
  • Typing a percentage where a decimal is expected. 40 is not a probability between 0 and 1. Type 40% or switch to percent; the calculator catches this for you.

Questions

What is the probability of rolling two sixes with two dice?

The dice are independent, so multiply. Both sixes is 1/6 × 1/6 = 1/36, about 0.0278 or 2.78%. At least one six is a different question. It is 1 − (5/6)² = 11/36, about 0.3056 or 30.56%. The “Two sixes” example loads the first, then choose P(A or B) under Find for the second.

What is the difference between “A or B” and “exactly one”?

“A or B” counts the outcomes where A happens, B happens or both happen. “Exactly one” leaves out the outcomes where both happen. In the weekend-rain example, rain on at least one day is 52%, but rain on exactly one day is 34%, because the 18% chance of rain on both days is taken out.

Does a 1 in 100 chance mean it will happen once in 100 tries?

Only on average. Over 100 independent tries at 1% each, the average number of successes is 100 × 0.01 = 1. The chance of at least one success is 63.4%, the chance of none is 36.6%, and the chance of exactly one is 36.97%. The rest of the time it happens two or more times.

Sources

  1. Introductory Statistics 2e, 3.1 Terminology OpenStax (Rice University) Probabilities run from 0 to 1; the complement P(A′) = 1 − P(A); “A or B” includes outcomes in both; P(A | B) = P(A and B) ÷ P(B), defined when P(B) is greater than 0.
  2. Introductory Statistics 2e, 3.2 Independent and Mutually Exclusive Events OpenStax (Rice University) Independence means P(A and B) = P(A) × P(B); mutually exclusive means P(A and B) = 0; the two are not the same; drawing without replacement makes events dependent.
  3. Introductory Statistics 2e, 3.3 Two Basic Rules of Probability OpenStax (Rice University) The multiplication rule P(A and B) = P(B) × P(A | B) and the addition rule P(A or B) = P(A) + P(B) − P(A and B).
  4. Introductory Statistics 2e, 3.4 Contingency Tables OpenStax (Rice University) A two-way table of two events makes joint and conditional probabilities easy to read off.
  5. Introductory Statistics 2e, 3.5 Tree and Venn Diagrams OpenStax (Rice University) A Venn diagram is a box for the sample space with circles for the events.
  6. Introductory Statistics 2e, 4.3 Binomial Distribution OpenStax (Rice University) Repeated independent trials with the same chance of success p on every trial; the mean number of successes is n × p.