Probability Calculator: P(A and B), P(A or B), Conditional Probability and Bayes' Theorem
Work out the probability of A and B, A or B, not A and A given B for independent, mutually exclusive or overlapping events. A second tab applies Bayes’ theorem to a medical test, and a third finds the chance of at least one success. Every answer shows the formula with your numbers.
Example: a disease affects 1% of people. The test detects 95% of cases and gives a false positive in 5% of healthy people. You test positive. How likely is it that you have the disease?
- PriceFree, no login or sign-up needed
- Your dataCalculated in your browser; nothing is saved
- Works onPhone, tablet or computer, any modern browser
- Made byDr. Muhammad Aammar Tufail, Codanics
- Published24 November 2026
- Last updated24 November 2026
📚 How to cite this tool
This tool is free. If it helped your thesis, paper, report or assignment, please cite it. It keeps the tools free and helps other students find them.
Tufail, M. A. (2026). Probability calculator [Online tool]. Codanics. Retrieved 24 November 2026, from https://codanics.com/tools/probability-calculator/
In-text citation: (Tufail, 2026) · Narrative: Tufail (2026)
The access date is today’s date, filled in automatically. Author: Muhammad Aammar Tufail. Published 24 November 2026.
How to use the probability calculator
- Choose a tab: Two events, Bayes’ theorem or At least one.
- Enter probabilities as decimals between 0 and 1 (30% = 0.3). For two events, say whether they are independent, mutually exclusive, or type the overlap P(A and B).
- Read the answers, the Venn diagram or the frequency table, and the step-by-step working.
- Press Copy result to paste the working into your homework or report.
What is probability?
Probability is a number from 0 to 1 that measures how likely an event is: 0 means impossible, 1 means certain. A probability of 0.25 is the same as 25%, or 1 chance in 4.
Probability rules for two events
| Rule | Formula | When to use it |
|---|---|---|
| Complement | P(not A) = 1 − P(A) | always |
| Multiplication (independent) | P(A and B) = P(A) × P(B) | one event does not change the other |
| Addition (general) | P(A or B) = P(A) + P(B) − P(A and B) | always |
| Addition (mutually exclusive) | P(A or B) = P(A) + P(B) | A and B cannot both happen |
| Conditional | P(A | B) = P(A and B) ÷ P(B) | you know B happened |
| Bayes’ theorem | P(H | E) = P(E | H) · P(H) ÷ P(E) | reverse a conditional probability |
| At least one | 1 − (1 − p)ⁿ | n independent tries |
Worked examples
Two independent events. P(A) = 0.5 (a coin shows heads) and P(B) = 0.4 (it rains). P(A and B) = 0.5 × 0.4 = 0.2. P(A or B) = 0.5 + 0.4 − 0.2 = 0.7. Because they are independent, P(A | B) = 0.2 ÷ 0.4 = 0.5, the same as P(A).
Bayes’ theorem and a medical test. A disease affects 1% of people. The test has 95% sensitivity and a 5% false-positive rate. Out of 10,000 people, 100 have the disease and 95 of them test positive. Of the 9,900 healthy people, 495 also test positive. So P(disease | positive) = 95 ÷ (95 + 495) = 0.161, only about 16%. This surprising result is called the base-rate fallacy: when a condition is rare, most positives are false positives.
At least one. If a seed has a 10% chance of failing, the chance that at least one of 10 seeds fails is 1 − 0.9¹⁰ = 0.651.
Common mistakes
- Confusing independent with mutually exclusive. Mutually exclusive events (with P > 0) are never independent: if one happens, the other cannot.
- Adding without subtracting the overlap. P(A or B) is not P(A) + P(B) unless the events cannot happen together.
- Mixing up P(A | B) and P(B | A). P(positive | disease) = 0.95 is not P(disease | positive) = 0.16.
- Multiplying probabilities of dependent events. Use P(A and B) = P(A) × P(B | A) instead.
Frequently asked questions
How do I calculate P(A and B)?
For independent events multiply: P(A and B) = P(A) × P(B). For dependent events use P(A and B) = P(A) × P(B | A). For mutually exclusive events P(A and B) = 0.
How do I calculate P(A or B)?
Use the addition rule: P(A or B) = P(A) + P(B) − P(A and B). Subtracting the overlap stops you counting it twice.
What is conditional probability?
Conditional probability is the chance of A when you already know B happened: P(A | B) = P(A and B) ÷ P(B). If P(A | B) equals P(A), the events are independent.
What is Bayes' theorem in simple words?
Bayes’ theorem updates a starting belief (the prior) with new evidence. P(H | E) = P(E | H) × P(H) ÷ P(E). It explains why a positive result for a rare disease is often a false positive.
What is the difference between independent and mutually exclusive events?
Independent events do not affect each other, so P(A and B) = P(A) × P(B). Mutually exclusive events cannot happen together, so P(A and B) = 0.
Are my numbers saved anywhere?
No. The calculator runs in your browser and nothing is saved or uploaded.
Do I need to log in or create an account to use the probability calculator?
No. There is no login, no sign-up and no email required. Open the page and start using it straight away, for free, on any device.
How do I cite this tool in my thesis or paper?
Use the citation box on this page. In APA 7th edition: Tufail, M. A. (2026). Probability calculator [Online tool]. Codanics. Retrieved [date you used it], from https://codanics.com/tools/probability-calculator/. BibTeX, RIS (EndNote, Mendeley, Zotero), MLA, Harvard, Chicago and Vancouver formats are also available.
Free guides and courses from Codanics
More free tools
See all free Codanics tools → · Codanics on YouTube · WhatsApp channel