List Compare
Paste two lists and see at once which items appear in both, which only in the first, which only in the second, plus the merged list and the duplicates inside each list. Works for e-mail addresses, IDs, product codes and names, and everything stays in your browser.
Your two lists
0 items
0 items
Options
Blank items are always ignored.
Results
In both lists
0Intersection, A ∩ B
In either list, merged
0Union without duplicates, A ∪ B
Only in A
0Difference, A − B
Only in B
0Difference, B − A
In one list but not both
0Symmetric difference
Duplicates inside A
0Items listed more than once, with their count
Duplicates inside B
0Items listed more than once, with their count
Your lists are processed in your browser and never uploaded. Small lists (under about 100 KB together) and your options are remembered on this device; larger lists are not saved.
How to use the list compare tool
- Paste or type your first list into List A and your second list into List B. The default is one item per line. If your items sit on one line, pick comma, semicolon or tab under “Items are separated by”.
- Choose the options. Ignoring case and trimming spaces are on by default, because they remove the most common false differences. You can keep the original order or sort the results A–Z.
- Read the seven result boxes. They update a moment after you stop typing, and each box shows how many items it holds.
- Press Copy under a box to copy its items, one per line, or Download results (.txt) to save all of them in one file.
- Use Swap A ↔ B to exchange the lists, Load sample data to see an example, or Clear both to start again.
What each result means
The results come from basic set operations. A short example makes them clear. Let List A be
apple, Banana, cherry, cherry, date and List B be
banana, Cherry, elderberry, fig, with case ignored.
| Result | Set name | Items |
|---|---|---|
| In both lists | Intersection | Banana, cherry (2) |
| Only in A | Difference A − B | apple, date (2) |
| Only in B | Difference B − A | elderberry, fig (2) |
| In either list, merged | Union | 6 distinct items |
| In one list but not both | Symmetric difference | apple, date, elderberry, fig (4) |
| Duplicates inside A | Repeated items | cherry (×2) |
The intersection holds what the two lists share. A difference holds what one list has and the other lacks, so it depends on the direction. The union is everything from both lists with every item written once. The symmetric difference is the union minus the intersection: everything that belongs to exactly one list. A result never contains the same item twice, and when case is ignored the first spelling the tool saw is the one shown. The duplicate boxes list items that occur more than once inside a single list, each once, with the number of occurrences.
How it works
Each piece of text is split at the separator you chose. Every item is then cleaned: spaces
at both ends are removed if trimming is on, and the text is converted to lower case to build
a comparison key if case is ignored. Empty items are dropped. Each list is stored in a
Map, a lookup table from key to the first spelling and the number of times the
key appeared. Finding the intersection means looking up each key of A in the table of B, and
a lookup takes about the same time however long the list is. The work therefore grows in
proportion to the number of items instead of with the square of it, which is why lists of
50,000 lines each can be compared without freezing the page.
The tool compares text, not meaning. Two items are equal only when their cleaned characters are identical. With sorting on, items are ordered with the browser’s language-aware rules, ignoring case, so the order of accented letters can vary slightly with your language settings.
Examples
Example 1 — case ignored. The fruit lists above give two items in both, two only in A, two only in B, six in the union and four in the symmetric difference.
Example 2 — case respected. Untick “Ignore upper/lower case”
with the same lists. Banana and banana are now different items, as
are cherry and Cherry. Nothing is in both lists, four items are only
in A, four only in B, and the union has eight items.
Example 3 — e-mail addresses. Choose the semicolon separator. List A is
ann@example.com; Bob@example.com; cara@example.com and List B is
bob@example.com; dan@example.com; Ann@example.com. With case ignored,
ann@example.com and Bob@example.com are in both lists (shown as
spelled in A), cara@example.com is only in A, and dan@example.com is
only in B. The union has four addresses.
Example 4 — leading zeros. List A is the three lines
007, 12, 5 and List B is 7,
12, 5. Items 12 and 5 are in both lists.
007 is only in A and 7 is only in B, because the text differs even
though the numbers are equal.
Typical uses
- E-mail lists: find subscribers who are on the new list but not the old one, or addresses that appear on both a mailing list and a suppression list.
- Inventory codes: compare the product codes in your system with the codes counted in the warehouse. “Only in A” shows what is missing on the shelf and “only in B” shows what is not yet recorded.
- Attendance: compare the registration list with the check-in list. Items in both are attendees, items only in the registration list are no-shows, and items only in the check-in list are walk-ins.
- Developers and analysts: compare sets of user IDs, permissions or configuration keys between two environments, or find the duplicates in one export.
Common pitfalls
- Hidden spaces.
appleandapplelook the same but differ. Keep trimming on. It also removes non-breaking spaces at the ends of items, but invisible zero-width characters are not removed and can still make equal-looking items differ. - Case. Names and e-mail addresses are often typed in different cases, so ignoring case is usually right. For case-sensitive codes, turn it off.
- Wrong separator. If everything lands in one item, the separator does not
match your data. Names such as
Smith, Johnneed the new-line separator, not the comma. - Number formatting. The tool compares text, not numeric value, so
007and7, or1.0and1, are different items. Make the formatting the same first. - Accents and look-alikes.
caféandcafeare different, and so are look-alike letters from different alphabets.
List compare versus a text diff tool
A text diff tool compares two versions of a document line by line and in order. It shows what was inserted, deleted or moved at each position, which is ideal for revisions of a file. List Compare ignores order and position completely. It treats each list as a collection and asks which items belong to which collection. Two lists that hold the same items in a different order are identical here. Choose a diff tool to review edits to one text, and List Compare to check membership between two lists.
Frequently asked questions
Are blank lines and repeated items a problem?
No. Blank and whitespace-only items are always ignored. Repeated items are counted for the summary and the duplicate boxes, but each item appears only once in the other results.
Which spelling is shown when case is ignored?
The first spelling seen. Items found in A show A’s spelling, even if B writes them differently. Items found only in B show B’s spelling.
How large can the lists be?
There is no fixed limit. Lists of 50,000 lines each are compared in a moment.
Can I compare more than two lists?
Not in one step. Compare A with B, copy a result such as the union or the intersection into List A, paste the third list into List B, and compare again.
Are my lists uploaded anywhere?
No. The comparison runs in your browser and nothing is sent to a server. Options, and lists under about 100 KB together, are saved in your browser’s local storage so they are still there when you return. Clear both removes them.
Related tools
- Word Counter — count words, characters and lines in any text.
- Regex Tester — test patterns that extract or clean items before comparing them.
- JSON Formatter — format and validate JSON data before pulling out IDs.
- Random Group Generator — split a list of names into random groups.
- Random Name Picker — pick a random item from a list.