---
title: Set Calculator — Union, Intersection & Difference
description: Calculate the union, intersection, and difference of two sets with this online calculator, with explanations and examples.
---

# Set Calculator — Union, Intersection & Difference

Use this **calculator** to compute the *union*, *intersection*, or *difference* between two sets. Paste your lists into **Data Set #1** and **Data Set #2**, choose an operation, and read the result in **Output**.

Site: [https://setcalculators.com/](https://setcalculators.com/)

## Operations

### Union

The **union** of two sets contains every element that appears in either set. Think of it as combining both lists and removing duplicates.

Example: `{berries, lettuce, apples} ∪ {lettuce, peppers, onions, berries}` → `{apples, berries, lettuce, onions, peppers}`

### Intersection

The **intersection** of two sets contains only elements that appear in *both* sets — the shared overlap in a Venn diagram.

Example: `{Jason, James, Emily, Robert} ∩ {Emily, Jared, Larry, Rachel}` → `{Emily}`

### Difference

The **difference** of two sets contains elements in the first set that do *not* appear in the second. Order matters — the second set is subtracted from the first.

Example: `{Stacy, Matthew, Jon, Caroline} − {Stacy, Matthew}` → `{Caroline, Jon}`

## Input and output

- Separate items with commas, spaces, or new lines.
- Duplicates are removed before computation.
- Format output with quotes, new lines, and/or commas in the UI.

## Other calculators

- [All calculators](https://setcalculators.com/calculators.html) — catalog of every tool
- [Cartesian product](https://setcalculators.com/cartesian-product.html) — all ordered pairs A × B
- [List unique](https://setcalculators.com/list-unique.html) — remove duplicates
- [Sort & reverse](https://setcalculators.com/list-sort.html) — A–Z, Z–A, or reverse

## Discovery

- Site catalog (markdown): `/calculators.md`
- This page (markdown): `/index.md`
- Cartesian product (markdown): `/cartesian-product.md`
- List unique (markdown): `/list-unique.md`
- Sort & reverse (markdown): `/list-sort.md`
- API catalog: `/.well-known/api-catalog`
- OpenAPI: `/openapi.json`
- Auth / access notes: `/auth.md`
