Set Union and Intersection Calculator

Free Set Union and Intersection Calculator — compute A∪B, A∩B, A-B, and B-A for any two sets of numbers, letters, or words instantly.

978.9K usesUpdated · 2026-04-28Runs locally · zero upload

How to Use Set Union and Intersection Calculator

The Set Union and Intersection Calculator makes it straightforward to compute set operations between two collections.

  1. Enter Set A — Type elements separated by commas, e.g. 1, 2, 3, 4. The Set Union and Intersection Calculator accepts numbers, letters, or words.
  2. Enter Set B — Type the elements of the second set in the same format.
  3. Read the results — The Set Union and Intersection Calculator instantly displays A∪B, A∩B, A−B, and B−A, along with the element count for each result.

Duplicates within a single set are automatically removed before any operation is performed. The Set Union and Intersection Calculator treats each unique token as one element.

Formula & Theory — Set Union and Intersection Calculator

The Set Union and Intersection Calculator implements the four fundamental set operations:

Union:          A ∪ B = { x | x ∈ A  or  x ∈ B }
Intersection:   A ∩ B = { x | x ∈ A  and x ∈ B }
Difference:     A - B = { x | x ∈ A  and x ∉ B }
Difference:     B - A = { x | x ∈ B  and x ∉ A }
Operation Meaning
A ∪ B All elements in A or B
A ∩ B Elements common to both A and B
A − B Elements in A but not in B
B − A Elements in B but not in A

The Set Union and Intersection Calculator preserves insertion order so results are predictable and easy to read.

Useful Identities

  • |A ∪ B| = |A| + |B| − |A ∩ B| — the inclusion-exclusion principle.
  • If A ∩ B = ∅, the sets are disjoint and A ∪ B simply concatenates them.
  • A − B and B − A are generally different; the Set Union and Intersection Calculator shows both to avoid confusion.

Use Cases for Set Union and Intersection Calculator

The Set Union and Intersection Calculator is a practical tool in many everyday and academic contexts:

  • Math homework — Solve set theory exercises and verify answers instantly with the Set Union and Intersection Calculator.
  • Data comparison — Find common items between two lists, such as shared product SKUs, overlapping customer IDs, or duplicate entries.
  • List deduplication — Merge two word lists and remove duplicates in one step using the union operation.
  • Discrete mathematics — Practice Venn diagram problems and inclusion-exclusion calculations.
  • Logic and programming — Understand the foundations of AND/OR logic and set-based database queries using the Set Union and Intersection Calculator.

From classroom exercises to professional data analysis, the Set Union and Intersection Calculator handles any combination of elements quickly and accurately.

Frequently asked questions about Set Union and Intersection Calculator

What does the Set Union and Intersection Calculator do?

The Set Union and Intersection Calculator takes two sets A and B, removes duplicate elements, and computes the union (A∪B), intersection (A∩B), difference (A-B), and difference (B-A).

What input formats are supported?

You can enter numbers, letters, single words, or any comma-separated text. The Set Union and Intersection Calculator automatically trims whitespace and removes duplicates within each set.

What is the difference between union and intersection?

The union A∪B contains all elements that appear in A or B (or both). The intersection A∩B contains only elements that appear in both A and B. The Set Union and Intersection Calculator shows both results side by side.

Is my data stored?

No. All calculations happen in your browser; nothing is sent to a server.