Beginner

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.
Comma or space separated numbers
Comma or space separated numbers
Union |A ∪ B|
7

Total unique elements across both sets

|A|
5
|B|
5
|A ∩ B| (intersection)
3
|A \ B|
2
|B \ A|
2
|A △ B| (sym. diff)
4
A ∪ B (Union)
{ 1, 2, 3, 4, 5, 6, 7 }
A ∩ B (Intersection)
{ 3, 4, 5 }
A \ B (Difference)
{ 1, 2 }
A △ B (Symmetric difference)
{ 1, 2, 6, 7 }
Sets are disjoint (A ∩ B = ∅)
No
A ⊆ B
No
B ⊆ A
No
29%
43%
29%
Only in A
In both (A ∩ B)
Only in B
Venn diagram breakdown: elements by region
Step by step
  1. 1

    Elements in A (unique)

    5
    Duplicate values are removed — a set holds each element at most once.
  2. 2

    Elements in B (unique)

    5
  3. 3

    Intersection |A ∩ B|

    3
  4. 4

    Union |A ∪ B| = |A| + |B| − |A ∩ B|

    5 + 5 − 3 = 7
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

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
A ∪ B = {x : x ∈ A or x ∈ B} • A ∩ B = {x : x ∈ A and x ∈ B} • A \ B = {x : x ∈ A and x ∉ B} • A △ B = (A \ B) ∪ (B \ A)
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

set theory calculator
venn diagram set operations calculator
union and intersection of two sets
set difference calculator
symmetric difference of sets
a union b calculator
a intersection b calculator
set operations math calculator

APA

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

Chicago

TG we-Calculate Editorial Team. "Union and Intersection Calculator — Set Operations." TG we-Calculate. 2026. https://we-calculate.com/calculator/union-intersection-calculator.

IEEE

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

BibTeX

@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?