Venn Diagram Calculator
Calculate region counts for a two-set or three-set Venn diagram from given cardinalities.
About Venn Diagram Calculator
A Venn diagram visualises set relationships. Given the sizes of sets A, B and their intersection, we can calculate each region: elements only in A, only in B, in both, and (given a universal set) in neither.
Formula
Inclusion-Exclusion
|A ∪ B| = |A| + |B| − |A ∩ B|
- |A|
- Size of A
- |B|
- Size of B
- |A∩B|
- Intersection size
Worked example
With the default values below, Venn Diagram Calculator returns Only A (A − B) of 20. Change any input above and every figure here is recalculated in your browser.
Inputs used
- |A| (size of A)minimum 0
- 30
- |B| (size of B)minimum 0
- 25
- |A ∩ B| (intersection)minimum 0
- 10
- Universal set size (optional)minimum 0
- 60
Results
- Only A (A − B)
- 20
- Only B (B − A)
- 15
- A ∩ B
- 10
- |A ∪ B|
- 45
- Neither (outside both)
- 15
Step by step
- 1Values used
- 2Inclusion-Exclusion
- 3Only A (A − B)= 20
- 4Only B (B − A)= 15
- 5A ∩ B= 10
- 6|A ∪ B|= 45
- 7Neither (outside both)= 15
Assumptions and limits
- The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
How does the inclusion-exclusion principle work?
Adding |A| + |B| double-counts the intersection, so we subtract |A∩B| once to get the true union size.
Can this handle three sets?
This calculator handles two sets. For three sets, the formula extends: |A∪B∪C| = |A|+|B|+|C|−|A∩B|−|A∩C|−|B∩C|+|A∩B∩C|.
