Built and fact-checked by the DocNectar team — see our editorial standards
Key Features
Instant Calculation
Get accurate results in real time with our optimized algorithm.
Mobile Friendly
Fully responsive design. Works on all devices & screen sizes.
Privacy Focused
Your data stays on your device. We don't store any inputs.
100% Free
No hidden costs. This tool is completely free forever.
Set theory gives a precise, formal vocabulary for describing how two collections of items relate to each other — what they share, what's unique to each, and what you get when you combine them entirely. Given two sets, this tool computes every standard set operation at once: the union (everything in either set), the intersection (only what's shared by both), each one-directional difference (what's in one set but not the other), and the symmetric difference (everything in exactly one set but not both). Beyond pure discrete mathematics coursework, these same operations are exactly what's happening under the hood any time you compare two lists of tags, customer segments, survey respondents, or database records — "which customers are in both group A and group B" is literally an intersection, and "which are in either group" is literally a union.
How it works
The union is formed by combining every unique element that appears in either set, with duplicates removed. The intersection keeps only the elements that appear in both sets simultaneously. Each one-directional difference — A minus B, and B minus A — starts from one set and removes any element also found in the other set, which is why the two directions generally produce different results. The symmetric difference combines both one-directional differences together, giving every element that belongs to exactly one of the two sets but not both — equivalently, it can also be computed as the union with the intersection removed.
- Enter set A (comma-separated).
- Enter set B (comma-separated).
- Click Calculate to see your results.
Examples
Two overlapping numeric sets
For A = {1,2,3,4} and B = {3,4,5,6}: the union is {1,2,3,4,5,6}, the intersection is {3,4}, A−B is {1,2}, B−A is {5,6}, and the symmetric difference is {1,2,5,6}.
Two sets with no overlap
For A = {apple, banana} and B = {cherry, date}: the union is {apple, banana, cherry, date}, the intersection is the empty set (∅), A−B equals A itself, B−A equals B itself, and the symmetric difference equals the full union — since nothing is shared, every element belongs to exactly one set.
One set fully contained in another
For A = {1,2} and B = {1,2,3,4}: the union is {1,2,3,4} (equal to B), the intersection is {1,2} (equal to A), A−B is the empty set (∅, since every element of A is also in B), B−A is {3,4}, and the symmetric difference is {3,4}.
Who should use it
- Set theory and discrete mathematics coursework.
- Data analysis tasks comparing two lists or categories.
- Comparing two customer segments, tag lists, or survey respondent groups.
Industry applications
- Discrete mathematics and computer science education
- Data analysis (comparing lists, tags, or categories)
Advantages
- Computes all four core set operations (union, intersection, both differences, symmetric difference) in a single pass.
- Handles sets of any comma-separated labels, not just numbers.
- Useful both for formal set theory and for practical list-comparison tasks.
Limitations
- Treats every element as a simple text label — no support for sets of intervals or other structured objects.
Common mistakes to avoid
- Assuming set difference works the same in both directions — A-B and B-A are almost always different sets.
- Forgetting to remove duplicate entries within a single set before comparing, which can distort what "unique elements" actually means for that set.
- Confusing the symmetric difference (exactly one set, not both) with the union (either set, including both).
Best practices
- When double-checking by hand, verify that the union always equals the intersection plus the symmetric difference (a useful cross-check).
- List each set's elements without duplicates before entering them, for the cleanest comparison.
- Use the one-directional differences (A−B, B−A) specifically when you need to know what's unique to just one side, rather than the combined symmetric difference.
Tips
- The intersection is always a subset of both the union and either original set — a quick sanity check on your computed result.
- Remove duplicate entries from each set before comparing for the most reliable result.