usefmtly

How to Compare Two Lists

What the three comparison outputs mean, when to use each, and how to interpret similarity between lists.

The three comparison outputs

Comparing two lists produces three groups. Understanding what each group means is the foundation of any list comparison task.

List A

apple

banana

cherry

date

List B

banana

date

elderberry

fig

Only in A

apple, cherry

Items that exist in List A but not in List B. These are entries that were removed, not added to B, or unique to A's source.

In both lists

banana, date

Items that appear in both lists. This is the intersection — what both sources have in common.

Only in B

elderberry, fig

Items that exist in List B but not in List A. These are entries that were added to B, or unique to B's source.

Union, intersection, and difference

These three set operations cover most comparison tasks:

Intersection (items in both)

Everything that appears in both List A and List B. Useful for finding overlap — customers who are in both segments, keywords that rank on both platforms, products that appear in both catalogues.

A ∩ B = { banana, date }

Difference A minus B (only in A)

Everything in A that is not in B. Useful for finding what was removed, what A has that B is missing, or entries that exist in your source but not your target.

A − B = { apple, cherry }

Difference B minus A (only in B)

Everything in B that is not in A. Useful for finding what was added, what B has that A is missing, or new entries that appeared in the target.

B − A = { elderberry, fig }

Union (everything, deduplicated)

Every item from both lists combined, with duplicates removed. Useful for merging two lists into one clean master list without repeats.

A ∪ B = { apple, banana, cherry, date, elderberry, fig }

How similar are two lists? Jaccard similarity

Jaccard similarity is a simple score between 0 and 1 that measures how much two lists overlap relative to their combined size.

Jaccard = |A ∩ B| ÷ |A ∪ B|

Using the example above: intersection has 2 items, union has 6 items. Jaccard = 2 ÷ 6 = 0.33 (33% overlap).

  • 0.0 – 0.2Very little overlap. The lists are mostly different.
  • 0.2 – 0.5Moderate overlap. Some shared items, but significant differences.
  • 0.5 – 0.8High overlap. The lists are substantially similar.
  • 0.8 – 1.0Very high overlap. The lists are nearly or completely identical.

Common use cases

  • Email list management: Compare a new subscriber list against an existing list to find new signups (only in B) and unsubscribes (only in A).
  • SEO keyword analysis: Compare keywords ranking on two different dates to find keywords you gained (only in B) and keywords you lost (only in A).
  • Inventory reconciliation: Compare a warehouse list against an order list to find items not yet shipped (only in A) or items ordered that are not in stock (only in B).
  • Data migration auditing: After migrating records from one system to another, compare the source and destination lists to verify nothing was missed.
  • Competitor analysis: Compare your product catalogue against a competitor's to find products you both offer (both), products only you have (only in A), and gaps in your catalogue (only in B).

Free tools for this