Set operations calculator

Type the items of set A and set B separated by commas or new lines. You get the union, intersection, both differences, the symmetric difference, the sizes, whether one set contains the other and the Jaccard similarity. Duplicates are removed.

Items separated by commas, semicolons or new lines. Numbers or words.
Same format as set A.
Union (A ∪ B){1, 2, 3, 4, 5, 6, 7}
Intersection (A ∩ B){4, 5}
Difference (A − B)
{1, 2, 3}
Difference (B − A)
{6, 7}
Symmetric difference (A △ B)
{1, 2, 3, 6, 7}
Sizes
|A| = 5, |B| = 4, |A ∪ B| = 7, |A ∩ B| = 2
Relation
A and B overlap, neither contains the other
Jaccard similarity
0.285714

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Type set A and set B.
  2. Choose whether letter case matters.
  3. Read the results; each set has a copy button.

How it works

Items are split at commas, semicolons and new lines, trimmed and de-duplicated, keeping the order of first appearance. The union lists A first and then the items only in B. An empty result is shown as ∅.

Worked example

A = {1, 2, 3, 4, 5}, B = {4, 5, 6, 7}:

  • Union: {1, 2, 3, 4, 5, 6, 7}
  • Intersection: {4, 5}
  • A − B = {1, 2, 3}, B − A = {6, 7}
  • Symmetric difference: {1, 2, 3, 6, 7}
  • Jaccard similarity: 2 / 7 ≈ 0.285714

Tips

  • Paste a column from a spreadsheet; each line becomes an item.
  • To compare lists of words ignoring capitals, switch to the ignore-case option.

Frequently asked questions

What is the difference between A − B and B − A?

A − B holds the items of A that are not in B, and B − A the reverse. They are generally different.

What is the symmetric difference?

The items that are in exactly one of the two sets: (A − B) together with (B − A).

What is the Jaccard similarity?

The size of the intersection divided by the size of the union. It is 0 for disjoint sets and 1 for equal sets. Two empty sets are shown as 1.

Are items compared as numbers or text?

As text after trimming spaces. So 1 and 01 are different items, while 1 and 1 with spaces around it are the same.

More in Math

All tools in this category: Math ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.