Venn Diagram Calculator — Two-Set Union, Intersection & Probability
Enter the sizes of two sets A and B, their intersection, and the total universe — and get the union, the four Venn regions, all probabilities, and conditional probabilities P(A|B) and P(B|A).
Elements in A or B or both: n(A) + n(B) − n(A∩B)
60
in unionA only
20%
A∩B
10%
B only
30%
Neither
40%
- 1
n(A) + n(B)
30 + 40 = 70 - 2
n(A∪B) — subtract intersection
70 − n(A∩B) = 70 − 10 = 60Subtracting A∩B removes elements counted twice (inclusion-exclusion principle).
How does this calculator work?
n(A∪B) = n(A) + n(B) − n(A∩B). The four Venn regions are A only, A∩B, B only, and neither. Divide by universe size N to get probabilities. Conditional: P(A|B) = n(A∩B)/n(B). Enter all four counts to get every set and probability result instantly.
Formula
How this is calculated
A Venn diagram partitions a universal set of N elements into four mutually exclusive regions: elements in A only, elements in B only, elements in both A and B (the intersection A∩B), and elements in neither. The inclusion-exclusion principle gives the union n(A∪B) = n(A) + n(B) − n(A∩B); subtracting the intersection prevents double-counting the shared elements.
Probabilities are found by dividing each count by the universe size N. P(A∩B) is the probability that a randomly chosen element belongs to both sets, and P(A∪B) is the probability it belongs to at least one. The conditional probability P(A|B) — "the probability of A given B" — equals n(A∩B) / n(B): among elements already known to be in B, what fraction are also in A? Similarly P(B|A) = n(A∩B) / n(A).
This calculator handles two-set scenarios. For three sets add a second calculation step using the three-set inclusion-exclusion formula: n(A∪B∪C) = n(A)+n(B)+n(C) − n(A∩B) − n(A∩C) − n(B∩C) + n(A∩B∩C).
Frequently asked questions
When you add n(A) and n(B), elements in the intersection A∩B are counted twice. Subtracting n(A∩B) once corrects this, giving the true union size. This generalises: for three sets you subtract all three pairwise intersections and add back the triple intersection.
P(A∩B) is the probability that a randomly chosen element from the whole universe is in both A and B. P(A|B) is the probability it is in A given that you already know it is in B — a conditional or restricted probability. P(A|B) = P(A∩B) / P(B), so it is always ≥ P(A∩B) (unless P(B) = 1).
A and B are statistically independent when P(A∩B) = P(A) × P(B), equivalently when P(A|B) = P(A). If the calculator shows P(A|B) equals P(A) in the results, the two sets are independent in that universe.
Also known as
TG we-Calculate Editorial Team. (2026). Venn Diagram Calculator — Two-Set Union, Intersection & Probability [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/venn-diagram-calculator
TG we-Calculate Editorial Team. "Venn Diagram Calculator — Two-Set Union, Intersection & Probability." TG we-Calculate. 2026. https://we-calculate.com/calculator/venn-diagram-calculator.
TG we-Calculate Editorial Team, "Venn Diagram Calculator — Two-Set Union, Intersection & Probability," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/venn-diagram-calculator
@misc{wecalculate_venn_diagram_calculator, title = {Venn Diagram Calculator — Two-Set Union, Intersection & Probability}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/venn-diagram-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
