Works on this device
Text & List Comparison Tool
Paste two lists to find the items that are only in the first, only in the second, or in both. You can also measure how many words two texts share, or compare two short texts character by character. Everything is compared in this browser and is not uploaded.
Your two lists or texts
Check these values
Your values are worked out in this browser. They are not sent to a server.
The comparison will show here
Fill in both boxes, or choose Try an example.
Comparison
How it was worked out
How to compare two lists
- Put the first list in the first box and the second list in the second box, with one item on each line. You can also choose commas, semicolons or spaces as the separator, or open a file from your device.
- Read the result. It shows how many items are only in the first list, only in the second list, and in both, and how many repeated copies each list has.
- Choose in Put in the text box which part you want to copy: all three parts, one part, the items that are in one list only, or all items with no repeats.
- Set the options if you need them: capital and small letters, spaces, how repeated items are counted, and sorting.
- Choose Copy text or Download file to keep the part, or Download CSV to keep the table with every item and its counts.
What the three options compare
- Two lists: which items are there. The order of the items does not matter. Use this for names, email addresses, product codes, keywords or any list with one item on each line.
- Two texts: how similar are their words: which words two texts or documents share, with three standard measures of similarity.
- Two short texts: character by character: each character that differs between two words, codes, links or lines, with its position and its Unicode code point.
- To see which lines of a text were changed, added or removed in order, use the Text Difference Checker.
How lists are compared
- Each list is read as a set of items. An item is only in the first list, only in the second list, or in both lists.
- Two items are the same when their characters are the same. By default capital and small letters count as the same and spaces at the start and end are ignored. You can change both rules.
- A letter with an accent is not the same as the letter without it:
caféandcafeare two items. - Empty items are left out and counted.
- Repeated items: the table shows how many times each item is in each list. The text box lists each item one time, or, if you choose to count the copies, as many times as it is left over. An item that is 3 times in the first list and 1 time in the second is then 2 times in only in the first list and 1 time in in both lists.
- Share of different items that are in both lists = items in both ÷ all different items of the two lists. This is the Jaccard index.
How the similarity of two texts is measured
- Each text is split into words. Punctuation at the edges of a word is taken off. By default capital and small letters count as the same.
- Jaccard similarity = different words in both texts ÷ different words in the first or the second text.
- Dice similarity = 2 × different words in both texts ÷ (different words in the first text + different words in the second text).
- Cosine similarity also uses how often each word is used. It is the sum of (times in first × times in second) over all words, divided by the product of the lengths of the two count lists.
- All three go from 0% (no word in common) to 100% (the same words). They do not look at the order of the words or at their meaning.
How two short texts are compared
- The tool finds the edit distance (Levenshtein distance): the smallest number of single characters that must be replaced, removed or added to turn the first text into the second.
- Similarity = 1 − edit distance ÷ the number of characters of the longer text.
- In the text box,
[-text-]marks characters that are only in the first text and{+text+}marks characters that are only in the second. - The table gives the code point of each character that differs, such as U+00A0 for a no-break space. This finds differences that you cannot see.
Worked example
First list: apple, Banana, cherry, apple, date, fig. Second list: banana, cherry, cherry, elderberry, fig, an empty line, grape. Each list has 6 items and 5 different items, and 1 empty item is left out.
Only in the first list: apple and date (2). Only in the second list: elderberry and grape (2). In both lists: Banana, cherry and fig (3). There are 7 different items, so the share in both lists is 3 ÷ 7 = 42.9%. Each list has 1 repeated copy. If you count the copies, cherry is also 1 time in only in the second list, because it is there 2 times and the first list has it 1 time.
The texts The quick brown fox jumps over the lazy dog. and A quick brown dog jumps over the lazy fox and the cat. have 8 and 11 different words and share 8. Jaccard similarity is 8 ÷ 11 = 72.7%, Dice similarity is 16 ÷ 19 = 84.2% and cosine similarity is 88.6%.
kitten and sitting have an edit distance of 3: [-k-]{+s+}itt[-e-]{+i+}n{+g+}. The similarity is 1 − 3 ÷ 7 = 57.1%.
Limits you should know
- A list comparison does not look at the order of the items. A similarity measure does not look at the order or the meaning of the words. None of them is a plagiarism check.
- Lists and texts can have up to 1,000,000 characters each, and files up to 5 MB. The character by character option takes up to 2,000 characters in each box.
- The comma and semicolon separators do not understand quotes. An item that has a comma inside it is split.
- Words are split at spaces. Each Chinese character and Japanese kana counts as one word. Thai and other languages written without spaces are not split into words.
- When two short texts can be changed into each other in more than one shortest way, the tool shows one of these ways.
- From Word and PDF files only the text is read. Scanned pages are pictures and cannot be read.
- JSON, XML and other structured data are compared here as plain items or words only. The tool does not understand their structure.