Compare Two Lists

Paste one list on each side, one item per line. The three columns show what's only in A, only in B and in both.

Only in A (1)

  • apples

Only in B (1)

  • coffee

In both (3)

  • bread
  • milk
  • eggs

Last reviewed:

Only in A, only in B and in both

Comparing two lists sorts every item into one of three groups. In set terms, “only in A” is the difference A minus B, “only in B” is B minus A, and “in both” is the intersection. Together they cover every distinct item in either list, each exactly once.

Example: Who still owes for the field trip

  1. List A: the 28 students going on the trip
  2. List B: the 25 names on the payment record
  3. In both: 24 students who are going and have paid
  4. Only in A: 4 students who still owe
  5. Only in B: 1 name that paid but isn't on the trip list

Chase the 4, and check the 1 by hand. It's usually the same student entered two ways, such as Sam Khan and Samuel Khan.

The counts double as a check. Only in A plus in both should equal the number of different items in A. If that comes out lower than the length of list A, the list has repeats, which are counted once.

Everyday jobs for a list comparison

List AList BColumn to read
Invited guestsRSVPs receivedOnly in A: who hasn't replied
Last month's membersThis month's membersOnly in A: who left. Only in B: who joined
Products on the websiteProducts in the stock countOnly in A: listed but not counted. Only in B: counted but not listed
Class rosterNames on handed-in assignmentsOnly in A: missing work
Documents requiredDocuments receivedOnly in A: what to chase
Volunteers who signed upVolunteers who showed upOnly in A: no-shows to follow up with

Mailing lists are another common case. Compare your current newsletter list with the addresses from a sign-up sheet, and “only in B” is exactly who to add. Each result column keeps the order of the list it came from, so if list A was sorted by date or priority, the results are too.

Comparing two spreadsheet columns

Copy one column from each spreadsheet, paste them on either side, and you have the answer without writing a lookup formula. Compare a column of unique IDs, such as customer numbers or email addresses, rather than names, which are far more likely to be typed two ways.

Example: Two exports of customer IDs

  1. List A: 1,240 IDs from the old system
  2. List B: 1,198 IDs from the new one
  3. In both: 1,150. Only in A: 90. Only in B: 48

90 customers didn't make it across in the move, and 48 are new since the export. The counts add up (1,150 + 90 = 1,240), so neither list had repeats.

Whole rows work too. Copy several columns at once and each row arrives as one line with tabs between the cells, so a row only matches when every cell in it is the same.

Why matching items show up as different

Items match once the spaces at each end are trimmed and, unless case sensitivity is on, with capital letters ignored. Everything else has to be identical, and that's where most surprises come from.

  • Spaces inside an item. “Khan, Sam” with an extra space after the comma won't match “Khan, Sam”. Clean both lists with Remove Extra Spaces first.
  • Different formats. “Sam Khan” and “Khan, Sam”, “St.” and “Street”, or a phone number with and without dashes are different text, even when they mean the same thing.
  • Lost leading zeros. Spreadsheets often turn a code like 00427 into the number 427, so one export has the zeros and the other doesn't.
  • Invisible characters. Non-breaking spaces from web pages and curly apostrophes (O’Brien against O'Brien) look identical on screen but aren't.

If the same names seem to fill both “only” columns, the lists are in different formats. Fix the format of one list, then compare again.

When to turn on case sensitive matching

Leave it off for names, email addresses and most everyday lists, where Maria and MARIA are the same person. When an item matches with different capitals, the “in both” column shows it the way list A spells it.

Turn it on when capitals carry meaning: product or part codes where AB-12 and ab-12 are different items, file names on systems that treat Report.pdf and report.pdf as two files, or short codes that are case-sensitive by design.

Comparing lists vs comparing documents

This tool treats each list as a set: order doesn't matter and repeats count once. When order matters, or you want to see what changed inside a line, use Compare Text in lines mode instead. And for a prize draw among the people who appear on both lists, paste the “in both” column into the Name Picker.

Sources and further reading

How to use it

  1. 1Paste list A and list B, one item per line.
  2. 2Turn on case sensitive matching if capital letters matter.
  3. 3Copy any of the three result columns.

Questions

Are spaces and capital letters ignored?

Spaces at the start and end of each item are ignored, and so are capital letters unless you turn on case sensitive matching.

What about duplicates inside one list?

Each item is counted once, so a list with repeats still gives clean results. Use the remove duplicate lines tool if you want to clean a single list.

Is my text uploaded anywhere?

No. Everything happens in your browser; your text never leaves your device.

Also handy: Text to QR Code, Shuffle a List