Union and Intersection Calculator — Set Operations
Enter two sets of numbers and instantly get their union (A ∪ B), intersection (A ∩ B), differences (A \ B and B \ A), symmetric difference (A △ B), subset relationships, and a Venn-style size breakdown.
Total unique elements across both sets
- 1
Elements in A (unique)
5Duplicate values are removed — a set holds each element at most once. - 2
Elements in B (unique)
5 - 3
Intersection |A ∩ B|
3 - 4
Union |A ∪ B| = |A| + |B| − |A ∩ B|
5 + 5 − 3 = 7
How does this calculator work?
Enter two comma-separated number lists. Union (A ∪ B) = all unique elements from either set. Intersection (A ∩ B) = elements in both. Difference (A \ B) = elements only in A. Symmetric difference (A △ B) = elements in one set but not both. The Venn bar shows the size of each region. Sets ignore duplicates.
Formula
How this is calculated
Set theory is a foundational branch of mathematics that treats collections of distinct objects (elements). The four main binary set operations are defined as follows. The union A ∪ B collects every element that appears in at least one of the two sets — duplicates are merged because sets only hold unique values. The intersection A ∩ B keeps only elements present in both sets simultaneously. The difference A \ B removes from A any element that also appears in B, leaving only elements exclusive to A. The symmetric difference A △ B is the union of both one-sided differences — elements that are in exactly one of the two sets but not in both.
This calculator parses comma-separated numbers from each field, deduplicates them (sets have no repeats), then computes all four operations and lists element counts. The Venn-diagram bar shows how the total elements split across the three regions: only-in-A, in-both, only-in-B — giving a quick visual sense of how much the sets overlap.
Limitation: only numeric inputs are supported. For sets of strings or mixed types, the same logic applies mathematically, but this tool handles numbers only. All results are sorted in ascending order for readability.
Frequently asked questions
Union (A ∪ B) includes everything in either set — it gets bigger. Intersection (A ∩ B) includes only what both sets share — it can only be as large as the smaller set. If the sets share no elements, the intersection is the empty set ∅ and the sets are called disjoint.
A \ B (read "A minus B" or "A set-minus B") is the relative complement of B in A — the elements that are in A but not in B. For example, if A = {1,2,3} and B = {2,3,4}, then A \ B = {1}. Note that A \ B ≠ B \ A in general.
The symmetric difference A △ B = (A ∪ B) \ (A ∩ B) — you take the union and remove the intersection. It contains elements that are in one set or the other, but not both. It equals (A \ B) ∪ (B \ A). When the sets are disjoint, A △ B = A ∪ B; when one is a subset of the other, A △ B is the complement of the smaller set within the larger.
Also known as
TG we-Calculate Editorial Team. (2026). Union and Intersection Calculator — Set Operations [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/union-intersection-calculator
TG we-Calculate Editorial Team. "Union and Intersection Calculator — Set Operations." TG we-Calculate. 2026. https://we-calculate.com/calculator/union-intersection-calculator.
TG we-Calculate Editorial Team, "Union and Intersection Calculator — Set Operations," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/union-intersection-calculator
@misc{wecalculate_union_intersection_calculator, title = {Union and Intersection Calculator — Set Operations}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/union-intersection-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
