List Compare Tool (Common & Unique Lines)
Compare two text lists (one item per line) and instantly extract the lines common to both, the lines only in A, and the lines only in B using set operations. Useful for matching mailing lists or checking inventory duplicates. Everything runs in your browser — nothing is sent to a server.
Tips
- Compare your mailing list against an unsubscribe list to instantly extract the addresses you should exclude from your next send.
- Compare an inventory list against a purchase-order list to quickly find out which items haven't been ordered yet.
- Leading and trailing whitespace on each line is trimmed automatically, so stray spaces from copy-pasting won't affect the comparison.
- Even if a line appears multiple times in your input, the result shows each unique line only once, making it handy for cleaning up messy lists.
- Uncheck "Case-sensitive comparison" to treat inconsistent capitalization (like Example.com and example.com) as the same line.
Frequently Asked Questions
Side Note — Comparing lists with set operations
There's more than one way to find the "difference" between two lists. Line-based diff algorithms, like the ones used in the text diff tool, preserve order while searching for correspondences between lines — which makes them ideal for tracking changes in source code or config files. But for lists where order carries no meaning, like email addresses or inventory codes, thinking in terms of set operations (intersection and difference) is far more intuitive. This tool takes the latter approach.
In set theory, the "intersection" is the set of elements common to both sets, while the "difference" is the set of elements found in only one. In this tool, "common lines" corresponds to the intersection (A∩B), while "only in A" and "only in B" correspond to the differences (A−B and B−A) respectively. It's a simple mathematical operation, but it shows up constantly in practical work — deduplicating customer lists, narrowing down mailing targets, and more.
Under the hood, this tool compares lines using a JavaScript Map, keyed by a normalized version of each line (unchanged when case-sensitive, lowercased otherwise), recording the first original spelling encountered for each key. This lets it compare lists with thousands of lines quickly while still preserving the original capitalization of each output line.