Basic statistics

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.

✅ No login needed100% freeRuns in your browserNothing savedYour data stays on your device
Probability Calculator✅ Free · no login📚 Cite this tool
Your data never leaves your PC. Everything you type is calculated on your own computer or phone. Nothing is saved, not even in your browser, and it is gone when you close the page. Nothing is uploaded, stored or seen by Codanics, and no login is needed.
  • 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.

Citation · APA 7th edition

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.

🚀 Follow Codanics channel on WhatsApp for more updatesNew free tools, scholarships, PhD positions and research tips, straight to your phone. Free lessons on YouTube too.

How to use the probability calculator

  1. Choose a tab: Two events, Bayes’ theorem or At least one.
  2. 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).
  3. Read the answers, the Venn diagram or the frequency table, and the step-by-step working.
  4. 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

RuleFormulaWhen to use it
ComplementP(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
ConditionalP(A | B) = P(A and B) ÷ P(B)you know B happened
Bayes’ theoremP(H | E) = P(E | H) · P(H) ÷ P(E)reverse a conditional probability
At least one1 − (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.
Counting the number of ways first? The permutation and combination calculator gives nPr and nCr. For k successes in n trials, use the binomial probability calculator; for two categorical variables in a table, try the chi-square calculator.
Learn the statistics behind these numbers. Codanics has free statistics, R and Python lessons on YouTube and full courses for researchers.

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

Made by Dr. Muhammad Aammar Tufail, Codanics. First published 24 November 2026, last updated 24 November 2026. Found a bug or have an idea for a new tool? Tell us on the WhatsApp channel or in the comments on YouTube. Results are for learning and planning; check important analyses with a statistician or your supervisor.