Use this free union calculator and set operations calculator to find the union of sets, intersection of sets, or set difference. Paste lists into Data Set #1 and Data Set #2, choose an operation, and read the result in Output. Everything runs in your browser — your data is not uploaded to a server.

0 rows

Use commas, spaces, or new lines to separate items in your input sets.

Descriptions of Set Operations

In mathematics, a set operation is a function that takes two sets — unordered lists of items — and produces a third list based on a standard rule. These operations work on entire lists at once, unlike arithmetic on individual numbers.

See below for a detailed description of each operation.

Union

Union of two sets — both circles filled

The union of sets (the classic job of a union calculator) contains every element that appears in either set. Think of it as combining both lists and removing duplicates. In set notation: A ∪ B.

For example, suppose Mary and Carlos are buying fruits and vegetables at a farmstand. Mary's basket contains:

  • berries,
  • lettuce, and
  • apples

and Carlos's basket contains:

  • lettuce,
  • peppers,
  • onions, and
  • berries

When they get home, together they purchased:

  • apples,
  • berries,
  • lettuce,
  • peppers, and
  • onions

This is the union of the two sets!

Try it!

Intersection

Intersection of two sets — overlapping region filled

The intersection of sets contains only elements that appear in both sets — the shared overlap in a Venn diagram. In set notation: A ∩ B.

For example, suppose you are a teacher determining which students play multiple sports. The tennis team roster contains:

  • Jason,
  • James,
  • Emily, and
  • Robert

while the swim team roster includes:

  • Emily,
  • Jared,
  • Larry, and
  • Rachel

The only student on both teams is:

  • Emily

This is the intersection of the two sets!

Try it!

Difference

Difference of two sets — left circle minus overlap

The difference of two sets contains elements in the first set that do not appear in the second. Unlike union and intersection, order matters — the second set is subtracted from the first.

For example, suppose a teacher wants students in math courses except those taking geometry. The math roster is:

  • Stacy,
  • Matthew,
  • Jon,
  • Caroline

and the geometry roster is:

  • Stacy, and
  • Matthew

The remaining students are:

  • Caroline, and
  • Jon

This is the difference of the two sets!

Try it!

Set calculator FAQ

How do I find the union of two sets?

Enter each set in the boxes above, select Union, and read the output. The union gathers every unique item from either list — a free online union of sets calculator without signup. Example: {1, 2, 3} ∪ {3, 4} = {1, 2, 3, 4}.

How do I find the intersection of two sets?

Select Intersection instead. The result keeps only items present in both sets — the same idea as an intersection of sets calculator. Example: {1, 2, 3} ∩ {3, 4} = {3}.

What is the difference between union and intersection?

Union answers “in A or B (or both)?” Intersection answers “in A and B?” This union and intersection calculator also supports set difference: items in the first set that are not in the second (order matters).

Does this work for number-line intervals?

No. This tool works on finite lists of elements (text or numbers as discrete items), not continuous intervals like [0, 1] ∪ (2, 5]. Use list-style inputs for homework sets, tags, IDs, or names.

Is my data uploaded?

No. The set calculator runs entirely in your browser with JavaScript. Lists stay on your device unless you copy them yourself.