What does comparing two lists show?
Comparing two lists means asking which items appear in one, in the other, or in both. It is the same question whether you are checking which e-mail addresses are missing from a mailing list, which products are in the catalog but not in the stock file, which user IDs appear in two exports, or which packages differ between two servers. In set language, the answers are called difference, intersection, union and symmetric difference.
This tool takes two lists and shows five results at once: only in A, only in B, in both (the intersection), the union (everything, each item once) and the items that are in one list but not in both (the symmetric difference). Each result has its own count and its own copy button, and each can be sent straight to the line tools to be sorted, filtered or deduplicated further.
You can paste one item per line, or separate them with commas, semicolons or tabs. The tool finds the separator by itself. Before comparing, it can ignore upper and lower case, ignore accents, trim stray spaces, and treat items as numbers, so that 1, 1.0 and 01 count as the same value. It all runs in your browser; the lists are not uploaded or stored.
How to compare two lists
- Paste the first list in A and the second in B. The page opens with two small fruit lists, so you can see the results immediately.
- Leave the separator on Auto, or choose lines, comma, semicolon or tab.
- Turn the matching options on or off. "Ignore case" and "Ignore accents" are on by default, so "Maçã" and "maca" match. "Compare as numbers" is off, because most lists are text.
- Decide how repeated items count. "Count once" treats each list as a set. "Count repeats" treats them as bags: if A has
xthree times and B has it once, two copies ofxare only in A. - Choose the order of the results (as typed, A to Z or Z to A) and how to copy them (one per line, or separated by commas, semicolons or tabs).
- Press Copy on the block you need, or use "continue with" to open it in the line tools.
Examples
Which customers are missing from the new system
List A holds the customers of the old system and list B those of the new one. "Only in A" gives the customers that were not migrated; "Only in B" gives the ones that were added; "In both" are the matches.
Case and accents
With A = Maçã, Banana, Figo and B = maca, banana, uva, ignoring case and accents gives "In both" = Maçã and Banana, "Only in A" = Figo, and "Only in B" = uva. The spelling shown is the first one found, here the one from A.
Numbers written differently
Lists of IDs exported from different systems often differ in format. With "Compare as numbers", 007, 7 and 7.0 are the same value, and 1e3 equals 1000. Items that are not numbers are still compared as text.
Repeated items
A = a, a, b and B = a. In "Count once" mode, only A has b, and a is in both. In "Count repeats" mode, one a and the b are only in A, and one a is in both.
Common mistakes
- Invisible spaces. Two items that look identical differ if one has a trailing space. Keep "Trim spaces" on unless the spaces matter.
- A different separator in each list. Auto detects the separator of each list on its own, but a list with both commas and line breaks is read by lines. If your items contain commas, choose "Lines" so that they are not split.
- Expecting a sorted result. Results follow the order of your lists unless you pick A to Z or Z to A.
- Comparing numbers as text. Without the number option,
1.0and1are different items. Turn it on for lists of values, but not for codes with leading zeros that must stay distinct. - Forgetting empty lines. Empty items are skipped, so a blank line at the end does not appear as an item.
Frequently asked questions
How is this different from a text comparison?
A text comparison looks at lines in order and shows where they differ. This tool ignores order and position, and only asks which values exist in each list.
Is there a limit on the size of the lists?
There is no fixed limit; the work happens in your browser's memory. Lists of tens of thousands of items are fine, and very large ones depend on your device.
Which item is shown when two spellings match?
The first one found. In the union and the intersection that is the spelling in list A when the item exists there.
Are the results checked against a reference?
Yes. The set operations are tested against the system's comm and sort -u commands and against Python sets and counters.
What can I do with a result?
Send it to the line tools to sort, number or deduplicate it, or compare two versions of a text line by line with the text comparison. To remove accents from a whole list first, use the accent remover.