Compare two texts using Levenshtein, Jaccard, cosine

Compare two texts with separate character-edit, word-set, and word-frequency measures.

freeworks offlinenothing uploaded
ToolSimilarity Score
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Levenshtein distance counts the minimum single-character insertions, deletions, and substitutions that transform one normalized string into another. Jaccard and Dice use unique word sets, while cosine uses word-frequency vectors; they stay separate because identical-looking percentages can mean different kinds of overlap.

  • Case is ignored by default, while whitespace normalization remains optional so formatting changes can still be compared.

Worked example

Compare similar sentences
Compare character edits, unique words, and word frequencies
Input
											Input1: The quick brown fox
Input2: The fast brown fox
										
Output
												Jaccard: 0.6
Cosine: 0.75
Dice: 0.75

LEVENSHTEIN
Distance: 5
Similarity: 73.68
											

When to use this

Copy-edit comparisons, search ranking experiments, and duplicate-record reviews use different similarity measures for different failure modes.

Edge cases

  • cat cat dog and cat dog have the same Jaccard set score but different cosine frequencies.
  • A one-character typo changes a short identifier far more than a long paragraph.
  • Punctuation affects edit distance even when word-set metrics ignore it.

References