How to use the text similarity calculator
- Paste the first text and the second text into the two boxes. Two short words are loaded as a sample.
- Decide whether to ignore capital letters and whether to treat runs of spaces and line breaks as one space.
- Read the edit similarity, the edit distance and the word overlap.
- Look at the lists of words found in both texts and in only one.
Formula
edit distance = fewest single character insertions, deletions or swaps to turn one text into the other
edit similarity = 1 - edit distance / length of the longer text
word overlap (Jaccard) = different words in both / different words in either
Characters are counted as Unicode characters, so an emoji counts as one. Words are runs of letters and digits, compared in lower case.
kitten and sitting
Turning kitten into sitting takes three steps: change k to s, change e to i, and add g at the end. The edit distance is 3. The longer word has 7 letters, so the similarity is 1 - 3 / 7 = 0.5714, or 57.1%.
For the word overlap, take the two sentences the quick brown fox and the quick red fox jumps. They share the, quick and fox, and together have six different words (the, quick, brown, fox, red, jumps), so the overlap is 3 / 6 = 50%.
Two measures, two questions
Edit similarity asks how much of the text would have to be typed again to get from one version to the other. It is sensitive to the order of characters, so small typos barely change it, but moving a paragraph can change it a lot. It is the Levenshtein ratio, and it is useful for comparing names, titles and short strings.
Word overlap asks which words the texts have in common and ignores order and repeats. It is the Jaccard score of the two sets of words. It is useful for seeing whether two passages talk about the same vocabulary, but two texts with the same words in a different order score 100%.
What neither measure can tell you
Neither measure understands meaning. A sentence and its paraphrase can score low, and two sentences that say opposite things with the same words can score high. They are not a plagiarism check or a quality rating. To see exactly what changed between two versions, use the diff checker. To count words use the word counter, and to find doubled words use the repeated word finder.
Each text can have up to 10,000 characters so the comparison finishes quickly. Text is compared in your browser and never uploaded. Both texts are normalized to a standard Unicode form before comparing, so an accented letter written in two ways counts as the same.
Assumptions and limits
- Edit distance counts insertions, deletions and substitutions, each as one step.
- Characters are Unicode characters, and texts are limited to 10,000 characters each.
- Words are runs of letters and digits, with inner apostrophes kept, compared in lower case.
- Similarity is arithmetic on characters and words, not meaning.
Frequently asked questions
What is the edit distance between kitten and sitting?
It is 3: change k to s, change e to i, and add g. The similarity is 1 - 3/7, about 57%.
What is the difference between edit similarity and word overlap?
Edit similarity looks at characters in order. Word overlap looks at the set of different words and ignores order and repeats.
Does the order of words matter?
For edit similarity, yes. For word overlap, no. Two texts with the same words in a different order have full word overlap but lower edit similarity.
Can I use this to check for plagiarism?
No. The scores measure surface similarity only, and cannot tell whether text was copied or just uses similar words.