Skip to content
Yunedia Tools

Set Operations

Compute union, intersection, difference and symmetric difference of two sets, with subset checks.

|A|5
|B|5
Union A ∪ B{ 1, 2, 3, 4, 5, 8, 13 }
Intersection A ∩ B{ 2, 3, 8 }
Difference A − B{ 1, 5 }
Difference B − A{ 4, 13 }
Symmetric difference A △ B{ 1, 4, 5, 13 }
A ⊆ BNo
B ⊆ ANo

How to use

  1. Type the elements of set A and set B, separated by commas or spaces.
  2. Union, intersection, both differences and the symmetric difference appear instantly.
  3. You also see each set's size and whether A ⊆ B or B ⊆ A holds.

Notes

Elements are compared as strings, so “1” and “01” count as different elements. Duplicates are removed automatically. Results are sorted numerically when all elements look like numbers, and alphabetically otherwise. Empty input is treated as the empty set.

FAQ

Are the universal set and complements supported?
This tool works on two sets only and has no universal set. For a complement, enter the universal set as B and read B − A.
Can I use words instead of numbers?
Yes. Elements are split on commas and whitespace, so use commas if an element itself contains spaces.