List Set Operations
runs in your browserCompare two lists: what is in both, in either, only in one, or in one but not both. Ignore case, trim spaces, split on commas, then sort and copy.
List A
51 chars8 items, 7 distinct (1 repeated)
List B
40 chars7 items
Result
A ∩ B · 2 itemsabout this tool
Five ways to compare two lists
Paste one list into A and another into B, and the result shows any of these, each with its count:
- In both (A ∩ B): the items the two lists share. The classic question: which of these customers also signed up for that?
- In either (A ∪ B): every distinct item from both lists, once each, for merging two lists without repeats.
- Only in A (A − B) and only in B (B − A): what one list has that the other lacks, such as the email addresses on the old list that are missing from the new one.
- In one, not both (A △ B): everything except what they share.
These are set operations, so an item repeated within a list counts once. Under each list the tool says how many items it has and how many are repeats.
When two items count as the same
By default the spaces at either end of an item are ignored, and the two
ways Unicode can write an accented letter count as one. With ignore
case on, Apple and apple match too, as do the case forms some
languages write differently, such as Maße and MASSE, though the Turkish
dotless ı stays apart from i. Where two spellings match, the
result uses the first one seen, and for an item in both lists, list A's.
Items are split one per line by default. Choose comma, tab or any space for lists written another way; a comma list can also run over several lines.
Ordering and writing the result
Results come in the order the items were first found, A's before B's.
a–z sorts the way a dictionary does, ignoring case and accents, and
natural also reads numbers as numbers, so item 2 comes before
item 10. The result can be written one item per line or separated by
commas, then copied or saved as a text file named after the operation.
Limits
Up to 50,000 items a list. The result box shows the first 5,000 items of a longer result; copy and download give all of them. With the comma separator, a comma splits items however it is used, so quoted CSV fields that contain commas are split; for whole CSV files use the CSV diff instead. Nothing is uploaded.
To sort, de-duplicate or clean a single list rather than compare two, use the line tools.
questions
- How do I find the items that are in one list but not the other?
- Paste the lists into A and B and choose only in A for the items A has that B lacks, or only in B for the reverse. In one, not both gives the two together. In both gives the items they share, and in either gives every distinct item from the two lists combined.
- Are duplicates counted?
- No: these are set operations, so each distinct item appears once in a result, however often it is repeated in a list. Under each list the tool says how many items it has and how many are repeats, so you can see whether a list was clean to begin with.
- Does it treat Apple and apple as the same?
- Only with ignore case on. Spaces at either end of an item are ignored by default, and the two ways Unicode can write an accented letter count as the same. When two spellings match, the result uses the first one seen, from list A where an item is in both.
- Can it compare comma-separated lists?
- Yes. Choose comma, tab or any space as the separator, and the result can be written one per line or with commas. A comma list may also be split over lines. Quoted CSV fields that contain commas are not understood; for whole CSV files, compare them with the CSV diff tool instead.
- Is my data uploaded?
- No. Both lists are compared in your browser, and nothing is sent or kept.