Home · Everyday · Bases, Binary & Logic · Union and Intersection Calculator

Union and Intersection Calculator

Union, intersection and difference of two sets — everything in either, in both, or in one but not the other.

Your figures

Example result — edit the figures to make it yours

{1, 2, 3, 4, 5, 6}

Union A ∪ B

The union collects everything in either set (duplicates removed); the intersection keeps only what is in both. The headline figure is the size of the union.

Intersection A ∩ B{3, 4}
Difference A − B{1, 2}
|A ∪ B|6
|A ∩ B|2

What this calculator does

Union, intersection and difference of two sets — everything in either, in both, or in one but not the other. Where a measure is involved, US and metric units are both accepted — flip the unit toggle and the figures convert with the same definitions the formula uses. Every result on this page is computed from the formula stated below, with no hidden rounding steps.

The formula and method

A ∪ B collects both; A ∩ B keeps the overlap; A − B keeps what B lacks

Sets are deduplicated and order-free: {1, 2, 2, 3} is the set {1, 2, 3}.

Union collects every element of both sets; intersection keeps only the shared ones.

A ⊆ B holds exactly when every element of A also appears in B.

Worked example

With the example inputs this page opens with, the result is {1, 2, 3, 4, 5, 6} — union a ∪ b. The union collects everything in either set (duplicates removed); the intersection keeps only what is in both. The headline figure is the size of the union.

Quick reference

Quick reference — the worked example in full
FigureValue
Union A ∪ B{1, 2, 3, 4, 5, 6}
Intersection A ∩ B{3, 4}
Difference A − B{1, 2}
|A ∪ B|6
|A ∩ B|2

Computed with the same formulas as the calculator above — enter any values there for figures beyond this table.

Common questions

How does the Union and Intersection Calculator work?

Union, intersection and difference of two sets — everything in either, in both, or in one but not the other. Set A · Set B → Union, intersection, difference. The result updates as you type, and the formula and method on this page state the exact definitions used, so you can reproduce the calculation by hand.

What inputs does the Union and Intersection Calculator need?

Set A · Set B → Union, intersection, difference. Invalid entries — such as a zero denominator, an out-of-range value or a malformed list — produce a plain-language message instead of a misleading number.

Is the Union and Intersection Calculator free to use?

Yes. It runs entirely in your browser with no sign-up, and the same calculator is available as an embeddable widget via the Embed button, so it can be placed on another site with its calculation intact.