🧮
🧮 Math & statistics

Venn Diagram Calculator (2 or 3 sets: union, regions, “only” counts)

Results update as you type.

Your numbers

Understanding the Venn diagram calculator — concept and principle

This calculator fills in every region of a two- or three-set Venn diagram from the totals and overlaps you know, using the inclusion–exclusion principle. It gives the union, each "only" region, each pairwise region without the third set, the triple overlap, the counts in exactly one and exactly two sets, the number outside all sets and the probability of the union. Use it for survey problems, probability, statistics and logic puzzles.

Three-set Venn diagramFill from the centre outwards24191611644A 45B 38C 30outside 16Union8445 + 38 + 30 − 15 − 10 − 8 + 4 = 84
Start with the 4 in all three, then the pairwise-only parts (11, 6, 4), then the only-one parts (24, 19, 16).

How it is calculated

Two sets: n(A ∪ B) = n(A) + n(B) − n(A ∩ B); only A = n(A) − n(A ∩ B).

Three sets:

If any region comes out negative, the counts cannot happen together.

The principle

Adding the three set sizes counts elements in two sets twice and elements in all three sets three times. Subtracting the three pairwise overlaps fixes the double-counting but removes the triple region three times, leaving it uncounted, so it is added back once. This alternating add-subtract pattern is the inclusion–exclusion principle, and it extends to any number of sets. Working from the centre outward (triple first, then pairs, then singles) fills a Venn diagram without errors.

Worked example

Default inputs: U = 100, n(A) = 45, n(B) = 38, n(C) = 30, n(A ∩ B) = 15, n(A ∩ C) = 10, n(B ∩ C) = 8, n(A ∩ B ∩ C) = 4.

  1. Union = 45 + 38 + 30 − 15 − 10 − 8 + 4 = 84.
  2. Pairs without the third: A and B only 11, A and C only 6, B and C only 4. All three: 4.
  3. Only A = 45 − 15 − 10 + 4 = 24; only B = 19; only C = 16.
  4. Exactly one = 24 + 19 + 16 = 59; exactly two = 11 + 6 + 4 = 21.
  5. Outside all sets = 100 − 84 = 16; probability of the union = 0.84.
How Union (in at least one set) changes with n(A ∩ B ∩ C) (three sets only)How Union changes with n(A ∩ B ∩ C)80828486881234568Example: 84n(A ∩ B ∩ C) (three sets only)
Each point is the calculator re-run with only “n(A ∩ B ∩ C) (three sets only)” changed; the gold point is the default example. Change the inputs above and this chart follows your numbers.
n(A ∩ B ∩ C) (three sets only)Union (in at least one set)
181
282
383
484
585
686
888

How to read the result

The regions add up to the union: 59 + 21 + 4 = 84. "Only" regions answer questions like "how many like only tea?". The outside region is everyone in U who is in none of the sets. A negative region is a sign that the input data are inconsistent or contain a typing error.

Common mistakes

Keep in mind: Survey data often contain non-responses or overlapping categories that do not fit a clean Venn diagram. Check the data before drawing conclusions.

Frequently asked questions

What is the inclusion–exclusion principle?

A rule for counting a union: add the sizes, subtract the pairwise overlaps, add back the triple overlaps, and so on.

How do I find "only A" with three sets?

n(A) − n(A ∩ B) − n(A ∩ C) + n(A ∩ B ∩ C).

Why might I get a negative region?

The numbers entered are inconsistent; for example, an intersection larger than one of its sets.

Sources: Inclusion–exclusion principle for finite sets (e.g. OpenStax, Contemporary Mathematics (2023), §1.4–1.5)

Checked 9 Nov 2026. Standard inclusion–exclusion principle for the cardinality of a union of two and three finite sets.

🧮 All math & statistics tools →🌍 Calculators by country →