Venn Diagram Generator
Last updated: 27 June 2026
Reviewed by Gavin Meiring, Lead research and primary author ยท Doctoral Candidate (Corporate Governance) ยท Research and drafting assisted by AI
- John Venn introduced his diagrams in an 1880 paper titled 'On the Diagrammatic and Mechanical Representation of Propositions and Reasonings'.
- Venn diagrams were not the first of their kind โ Leonhard Euler used similar circle diagrams in the 18th century, now called Euler diagrams.
- Three overlapping circles can represent all 8 possible regions of three sets, which is why the classic three-circle Venn diagram is so useful.
Venn Diagram Generator
A Venn diagram generator creates visual diagrams showing the relationships between two or three sets, including their intersections and unions, and calculates set sizes and probabilities for each region. It is used by students learning set theory and probability, teachers creating visual aids, and data analysts illustrating overlapping categories.
How to Use the Venn Diagram Generator
- Select the number of sets: two or three.
- Enter a name and the total size (or probability) for each set.
- Enter the sizes of each intersection (overlap between pairs, and the central overlap for three sets).
- Click Generate to produce the Venn diagram with all regions labelled.
- Read off the computed values for each region: only A, only B, A and B only, all three, and so on.
The Formula
For two sets A and B:
|A union B| = |A| + |B| - |A intersect B|
Only A = |A| - |A intersect B| Only B = |B| - |A intersect B|
For three sets A, B, and C (inclusion-exclusion principle):
|A union B union C| = |A| + |B| + |C| - |A intersect B| - |A intersect C| - |B intersect C| + |A intersect B intersect C|
Each region of the Venn diagram corresponds to one of the eight exclusive subsets formed by three sets.
Real-World Example
In a class of 30 students, 18 study French, 15 study Spanish, and 8 study both.
|A| = 18 (French), |B| = 15 (Spanish), |A intersect B| = 8
Only French: 18 - 8 = 10 Only Spanish: 15 - 8 = 7 Both French and Spanish: 8 Neither: 30 - (10 + 7 + 8) = 30 - 25 = 5
|A union B| = 18 + 15 - 8 = 25
The diagram shows 10 students in the left (French only) region, 7 in the right (Spanish only) region, and 8 in the overlapping centre. Five students study neither language.
Set Theory in Everyday Analysis
Venn diagrams and set operations are practical tools for analysing any situation involving overlapping categories. In marketing, a Venn diagram might show customers who bought Product A, Product B, or both, helping identify the loyal cross-buyers in the intersection. In medicine, overlapping sets might represent patients with multiple conditions or risk factors, and the intersection reveals comorbidity rates. In database management, SQL joins (INNER JOIN, LEFT JOIN, UNION) correspond directly to Venn diagram regions: an INNER JOIN returns the intersection, a LEFT JOIN returns everything from the left set, and a UNION returns the combined set. In logic and probability, set operations map to logical connectives: intersection corresponds to AND, union to OR, and complement to NOT. Survey analysis frequently uses the inclusion-exclusion principle to avoid double-counting respondents who selected multiple options.
Frequently Asked Questions
What is the difference between union and intersection? The union of two sets (A union B) contains every element that is in A, in B, or in both. The intersection (A intersect B) contains only the elements present in both A and B simultaneously. The union is always at least as large as either individual set; the intersection is at most as large as the smaller of the two sets.
Can a Venn diagram have more than three sets? Yes, but diagrams with four or more sets cannot be drawn as simple overlapping circles while keeping all regions distinct and clearly visible. Four-set Venn diagrams use ellipses, and five-set diagrams use more complex shapes. For four or more sets, an Euler diagram (which only shows the regions that actually exist, omitting empty ones) is usually clearer than a complete Venn diagram.
What is the complement of a set? The complement of set A (written A' or A^c) contains all elements in the universal set that are not in A. If the universal set U has 100 elements and A has 30, then A' has 70. In probability, P(A') = 1 - P(A), which is a very useful rule for calculating the probability that an event does not occur.
What is a disjoint set? Two sets are disjoint (or mutually exclusive) if they have no elements in common: their intersection is the empty set. For example, the set of even numbers and the set of odd numbers are disjoint. In a Venn diagram, disjoint sets are drawn as non-overlapping circles. For disjoint events in probability, P(A union B) = P(A) + P(B) (no subtraction needed).
Item lists the tool reads
The generator takes a list of items for each set rather than a count for each set. Items are separated by commas, trimmed of surrounding spaces, and compared in lower case, so Cat and cat in the same list collapse into one entry. Two set mode uses the first two lists, and three set mode brings in the third. The labelled regions on the diagram come from the memberships, which means the tool answers the question of which items fall in each region as well as how many.
The steps above this section describe entering a total size for each set and the sizes of each intersection. The component has no fields for sizes, so a reader who follows those steps will find the diagram already filled from the item lists instead. Use the item lists for the tool and the size arithmetic in the sections below for pen-and-paper work.
Two sets, worked
The tool's own default entry is A = Cat, Dog, Fish, Bird, Hamster and B = Dog, Rabbit, Fish, Turtle, Guinea pig. Both sets have five items and they share two of them.
| Region | Items | Count |
|---|---|---|
| Only in Set A | Cat, Bird, Hamster | 3 |
| Only in Set B | Rabbit, Turtle, Guinea pig | 3 |
| In both sets | Dog, Fish | 2 |
| Union | those eight items | 8 |
The union check is the inclusion-exclusion formula on the printed counts: 5 plus 5 minus 2 is 8. The same identity holds for the region counts, 3 plus 3 plus 2 is 8. Nothing is lost in the overlap, which is the property that makes a Venn diagram worth drawing when a survey asks people to tick more than one box.
A three-set example
Adding a third set splits six of the seven regions apart, and the middle one is where the arithmetic gets interesting. Take A = Cat, Dog, Fish, Bird, Hamster, B = Dog, Rabbit, Fish, Turtle, Guinea pig and C = Fish, Cat, Rabbit, Ferret.
| Region | Items | Count |
|---|---|---|
| Only in Set A | Bird, Hamster | 2 |
| Only in Set B | Turtle, Guinea pig | 2 |
| Only in Set C | Ferret | 1 |
| Set A and Set B, not Set C | Dog | 1 |
| Set A and Set C, not Set B | Cat | 1 |
| Set B and Set C, not Set A | Rabbit | 1 |
| All three sets | Fish | 1 |
| Union | those nine items | 9 |
The seven region counts add to 9, which is the size of the union, so no item has been counted twice and none has been dropped. Fish appears in all three lists and sits in the centre region, Dog is in the first two and Cat and Rabbit are each in two lists. Reading the table against the lists is the fastest way to check a three-set diagram: every item in every list should appear in exactly one row.
Counting with inclusion and exclusion
When the inputs are sizes rather than items, the same structure holds and the arithmetic has to be done by hand. Start with the class example used above, 30 students, 18 taking French, 15 taking Spanish and 8 taking both. Only French is 18 minus 8, which is 10. Only Spanish is 15 minus 8, which is 7. The union is 18 plus 15 minus 8, which is 25, and the number taking neither language is 30 minus 25, which is 5. The four region counts, 10, 7, 8 and 5, add to 30.
Three sets need one more term. Take 40 people surveyed on three products, with 18 using A, 15 using B, 12 using C, 8 using A and B, 6 using A and C, 5 using B and C, and 3 using all three.
| Region | Size |
|---|---|
| Only A | 7 |
| Only B | 5 |
| Only C | 4 |
| A and B, not C | 5 |
| A and C, not B | 3 |
| B and C, not A | 2 |
| All three | 3 |
| Union | 29 |
The union can be checked two ways. Adding the eight region counts gives 29. The inclusion-exclusion sum gives the same figure: 18 plus 15 plus 12, minus 8, minus 6, minus 5, plus 3, which is 29. The 11 people outside every set are the complement, which is 40 minus 29. Each pairwise region drops the triple count before it is reported, so the pair of A and B contributes 5 to its own region and 3 to the centre, and the pair total of 8 is split rather than duplicated.
The source for the counting rule
The alternating sum over intersections is the inclusion-exclusion principle, an elementary result that Feller states in the first volume of An Introduction to Probability Theory and Its Applications and that appears in the standard set theory texts in the same form. It gives the probability version without any extra work: replace each set size with the probability of the event, and the union rule becomes the probability of A or B or both, which is P(A) plus P(B) minus P(A and B). The complement rule used on the class example is the simplest case, P(not A) equals 1 minus P(A), which is why the five students who take neither language are 5 out of 30, or 0.1667 as a probability.
Also try these free tools: