List Union vs. Intersection Explained
Union and intersection are the two core operations when you compare lists. The terms come from set theory, but you don't need any math background to use them. You just need to know which one gives you the answer you're actually looking for.
Quick answer
Union combines both lists into one list of every unique item, with duplicates removed. Intersection keeps only the items that appear in both lists. The union is always the same size or larger than either original list; the intersection is always the same size or smaller. Use a Compare Lists tool's union output to merge lists, and its intersection output to find what two lists have in common.
Try the operations on your own lists.
Open Compare Tool →Intersection: what's in both lists
The intersection of two lists is everything that appears in both. An item has to be in List A and List B to make it into the intersection. If it's in only one of them, it doesn't qualify.
Take these two lists:
List A
apple
banana
cherry
date
List B
banana
date
elderberry
fig
The intersection is banana, date. Those are the only two items that appear in both lists.
When to use intersection:
- Customers who appear in both your old and new CRM exports
- Products stocked by both of your suppliers
- Email addresses on both your active list and your unsubscribe list (remove these)
- Keywords your site and a competitor both rank for
Union: everything from either list
The union of two lists is every unique item from either list. If something appears in List A, in List B, or in both, it appears exactly once in the union.
Using the same lists above, the union is:
apple, banana, cherry, date, elderberry, fig
The important thing: union is not just "combine both lists." It's combine and deduplicate. If both lists contain "banana", the union has it once. If you want raw concatenation without deduplication, that's a stack operation, which the Merge Lists tool handles.
When to use union:
- Merging two keyword lists without duplicates
- Combining two team rosters into one complete roster
- Building a master list from multiple data sources
- Deduplicating two different exports of the same underlying dataset
A Only and B Only: what changed
These two outputs get less attention but are often the most useful. They show you the parts of each list that don't overlap.
- A Only: items in List A that aren't in List B. In the example above: apple, cherry.
- B Only: items in List B that aren't in List A. In the example above: elderberry, fig.
In code, A Only and B Only are set differences. In Python that's set(a) - set(b) and set(b) - set(a); difference between two lists in Python walks through it, including how to keep the original order.
Together, A Only and B Only tell you what changed between two versions of a dataset. The intersection tells you what stayed the same. This is the most common pattern: compare this month's customer list against last month's, and A Only gives you who dropped off while B Only gives you who's new.
A visual way to think about it
Picture two overlapping circles. The overlap in the middle is the intersection. Everything inside either circle is the union. The part of the left circle that doesn't overlap is A Only. The part of the right circle that doesn't overlap is B Only.
The Multi-List Compare tool draws this diagram interactively when you're comparing 2 to 5 lists at once. You can click regions to filter results by which lists they appear in.
More than two lists
With three or more lists, the same concepts apply. The intersection is items that appear in every list. The union is items that appear in any list. In between, there are items that appear in some lists but not all.
The Multi-List Compare tool handles this case directly. It breaks down all the overlap regions: in all three, in exactly two (and which two), in exactly one. It also draws the Venn diagram so you can see the structure at a glance.
Comparing more than two lists?
Multi-List Compare handles 3 to 8 lists, with a live Venn diagram.