Set operations calculator
Compute the core operations of set theory on two sets: union (A ∪ B), intersection (A ∩ B), difference (A − B and B − A), and symmetric difference (A △ B). It is for maths students, data wranglers and anyone comparing two lists of values.
How it works
Each input is split on commas and new lines, trimmed, and deduplicated — a set holds each member at most once. The chosen operation then runs:
| Operation | Result |
|---|---|
| Union (A ∪ B) | every element in A or B |
| Intersection (A ∩ B) | elements in both A and B |
| Difference (A − B) | elements in A but not B |
| Difference (B − A) | elements in B but not A |
| Symmetric difference (A △ B) | elements in exactly one set |
The symmetric difference equals (A − B) ∪ (B − A). The result and its cardinality (the number of members) are shown.
Example
With A = 5 and B = 7:
| Operation | Result | Size |
|---|---|---|
| Union | 7 | 7 |
| Intersection | 5 | 2 |
| A − B | 3 | 3 |
| Symmetric difference | 7 | 5 |
Pick an operation and the result updates instantly — all in your browser, with no network calls.