Skip to content
Omnikalc

Venn diagram calculator: count each region of two overlapping sets

Enter the total, the size of sets A and B and their overlap to get the union, the region counts and the probabilities of A or B, A and B, and the conditional probabilities.

Updated on
Your inputs

Value out of range

Value out of range

Value out of range

Value out of range

Results

A or B (union)

80

Consistent numbers
Only A
35
Only B
20
Neither A nor B
20
Probability of A or B
80.0%
Probability of A and B
25.0%
Probability of B given A
41.7%
Probability of A given B
55.6%

Venn diagrams are a clear way to see how groups overlap, and the counting behind them is simple. This Venn diagram calculator takes the total, the size of set A, the size of set B and the overlap to give the union, the number in only A, only B and neither, and the probabilities of A or B, A and B, and the conditional ones.

How the calculation works

  • Union |A ∪ B| = |A| + |B| − |A ∩ B|. The overlap is counted twice when the two sets are added, so it is subtracted once.
  • Only A = |A| − |A ∩ B|, and only B = |B| − |A ∩ B|. With the overlap, they make the three regions of the diagram.
  • Neither = total − union, the elements outside both circles.
  • Probabilities divide by the total. The probability of B given A is |A ∩ B| ÷ |A|, and the probability of A given B is |A ∩ B| ÷ |B|.

Example

Among 100 students, 60 like football (A), 45 like basketball (B) and 25 like both. The union is 60 + 45 − 25 = 80. Only football: 35, only basketball: 20, neither: 100 − 80 = 20. The probability of liking at least one is 80%, both 25%, basketball given football 25 ÷ 60 = 41.7%, and football given basketball 25 ÷ 45 = 55.6%.

Why it matters

Students, teachers, survey analysts and marketers use the counts to solve set problems, to read poll results and to check how audiences overlap. It is also an easy introduction to probability and to the inclusion-exclusion rule.

Good to know

The calculator handles two sets. Problems with three sets need an additional term for the triple overlap, and a different tool. The probabilities assume that every element in the universe is equally likely to be picked, and that the counts come from the same group. Real surveys also have non-response and rounding, so counts may not add up exactly. Check that the numbers are consistent before you use the percentages.

The probability calculator handles chance events, the combinations calculator counts selections and the Bayes theorem calculator updates a probability with new evidence.

Frequently asked questions

What is the inclusion-exclusion rule?

For two sets, the number of elements in the union is the sum of the sizes minus the size of the overlap, since the elements in both would be counted twice. In symbols, |A ∪ B| = |A| + |B| − |A ∩ B|. For three sets, the rule adds one more term for the triple overlap.

How do I read the regions of the diagram?

A two-set diagram has four regions: only A, only B, both, and neither. The three regions inside the circles add up to the union, and the region outside is the part of the universe in neither set. The four counts always add up to the total.

What is conditional probability here?

The probability of B given A is the share of A that is also in B, which is the overlap divided by the size of A. If it equals the probability of B, the sets are independent. Here it is a simple way to see the idea behind Bayes' theorem.

What if the numbers are impossible?

The overlap cannot be larger than the smaller of the two sets, and the union cannot be larger than the total. The calculator marks the result as impossible in those cases, which often means a typing error or a count that was made with a different group.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.