StatGardenREF. DESK
Calculators/Maths/Set operations
Maths

Set operations calculator

Union, intersection and differences of two sets of numbers.

Published 6 August 2026 · Updated 23 September 2026

What this calculator does

Set operations answer questions about membership: what is in either set, what is in both, and what is in one but not the other. Duplicates are ignored throughout, since a set either contains an element or it does not.

The symmetric difference is the one people forget. It collects everything in exactly one of the sets, which is the union with the intersection removed.

The formula

FormulaA∪B = elements in either set; A∩B = elements in both; A−B = in A but not B; A△B = in exactly one set

Both lists are deduplicated. Union collects every distinct element, intersection keeps those in both, and the differences keep elements unique to each set.

TermMeaning
UnionEverything appearing in either set.
IntersectionOnly what appears in both.
Symmetric differenceEverything in exactly one set, being the union less the intersection.

The inputs explained

FieldWhat to enter
Set A (comma separated)The elements of set A, comma separated. Duplicates are ignored.
Set B (comma separated)The elements of set B, comma separated.

When to use it

Comparing two lists

Finding what is common and what is unique is a constant practical task.

Learning set notation

Seeing all five operations on the same pair makes the definitions concrete.

Checking a Venn diagram

Each region of a two-set diagram corresponds to one of these operations.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

What happens when the sets stop overlapping?

The same first set against two different second sets.

Set A is 1, 2, 3, 4, 5
Set BIntersection (A ∩ B)Union (A ∪ B)
{3, 4, 5, 6, 7}3, 4, 51, 2, 3, 4, 5, 6, 7
{6,7,8}∅1, 2, 3, 4, 5, 6, 7, 8
Overlapping sets share 3, 4, 5 and union to seven elements. Disjoint sets have an empty intersection, and the union then simply contains everything from both, all eight elements.

Questions

Why are duplicates ignored?

Because a set is defined by membership, not by count. An element is either in a set or it is not, so listing it twice adds nothing. Multisets, which do track counts, are a different structure.

What does the empty set symbol mean?

That the result contains nothing at all. Two sets with no common elements have an empty intersection, and they are described as disjoint.

Does the order of the sets matter?

For union, intersection and symmetric difference, no: all three are commutative. For the differences it matters a great deal, since A minus B and B minus A are generally quite different.

How does this relate to a Venn diagram?

Directly. Each operation corresponds to shading a particular region: the intersection is the overlap, the differences are the two outer regions, and the symmetric difference is both outer regions together.

For counting selections from a set, see the probability calculator. For descriptive statistics on a list, see the descriptive statistics calculator.