Set Theory Calculator

Set Theory Calculator. Enter up to three sets (A, B, C) and a universal set (U) using comma-separated values, then choose your set operation — Union, Intersection, Complement, Difference, or Power Set. The Set Theory Calculator returns the resulting set, its cardinality, and a visual breakdown of which elements appear in each region. Also try the Bayes' Theorem Calculator.

Set Theory Calculator inputs

Enter elements separated by commas.

Enter elements separated by commas.

Optional third set for multi-set operations.

Required for Complement operation.

Results

Result Set

--

Cardinality (Number of Elements)

--

Elements Only in A

--

Elements Only in B

--

Elements in Both A and B

--

Results Table

What is the union of two sets?

The union of sets A and B (written A ∪ B) is the set of all elements that belong to A, to B, or to both. Duplicate elements are included only once. For example, if A = {1, 2, 3} and B = {3, 4, 5}, then A ∪ B = {1, 2, 3, 4, 5}. See also our find Variant B — Chance to Beat Control with Bayesian A/B Test Calculator.

What is the intersection of two sets?

The intersection (A ∩ B) contains only the elements that appear in both A and B simultaneously. Using the example A = {1, 2, 3} and B = {3, 4, 5}, the intersection is {3}. If no elements are shared, the result is the empty set ∅.

What is the complement of a set?

The complement of set A (Aᶜ) contains all elements in the universal set U that are not in A. You must define U for this operation. For instance, if U = {1, 2, 3, 4, 5} and A = {1, 2}, then Aᶜ = {3, 4, 5}.

What is the difference between two sets?

The set difference A − B contains elements that are in A but not in B. It is not the same as B − A. For example, if A = {1, 2, 3, 4} and B = {3, 4, 5}, then A − B = {1, 2} and B − A = {5}.

What is the symmetric difference of two sets?

The symmetric difference (A △ B) contains elements that are in A or B but not in both — essentially the union minus the intersection. For A = {1, 2, 3} and B = {3, 4, 5}, the symmetric difference is {1, 2, 4, 5}.

What is the power set of a set?

The power set of A is the collection of all possible subsets of A, including the empty set and A itself. If A has n elements, the power set has 2ⁿ subsets. For example, if A = {1, 2}, the power set is {∅, {1}, {2}, {1, 2}}. Note: large sets produce very large power sets.

Can this calculator handle non-numeric elements?

Yes. Elements are treated as strings, so you can enter letters, words, or numbers. Just separate them with commas — for example, 'a, b, c' or 'apple, banana, cherry'. Whitespace around commas is ignored automatically.

What does cardinality mean?

Cardinality refers to the number of elements in a set. A set with 5 elements has cardinality 5, written |A| = 5. The cardinality of the empty set is 0. This calculator displays the cardinality of the result set after every operation. You might also find our Probability Calculator useful.