Tools / Levenshtein Distance & Text Similarity

Levenshtein Distance & Text Similarity.

Compare two strings with Levenshtein, Damerau, Jaro–Winkler, LCS and Hamming metrics.

Runs in your browser

Ctrl/⌘ + Enter to run · Ctrl/⌘ + Shift + C to copy the result

Result
Metrics
Edit script

About Levenshtein Distance & Text Similarity

Edit distance tells you how many single-character changes turn one string into another. This calculator gives the classic Levenshtein distance, which counts insertions, deletions and substitutions, and the Damerau variant, which also counts swapping two neighbouring characters as one edit, the most common typing mistake. Kitten and sitting are three edits apart: two substitutions and one insertion, and the edit script lists exactly those steps with their positions. The similarity percentage is one minus the distance divided by the longer length, which is easy to explain to non-developers. Jaro–Winkler is a score between zero and one that rewards a shared prefix and is widely used for matching names and addresses, while the longest common subsequence shows how many characters appear in both strings in the same order. Hamming distance only applies when both inputs have the same length. You can compare by words instead of characters to measure how far two sentences or titles drift apart. Comparison works on Unicode code points, so an emoji counts as one character. A frequent mistake is comparing strings that differ only in case or spacing; switch off case sensitivity or ignore whitespace to focus on real differences. Everything is computed in your browser, and inputs up to about five thousand units each are supported.

How to Use

  1. Paste the two texts.
  2. Choose characters or words and the case and whitespace options.
  3. Read the metrics and the step-by-step edit script.

Frequently Asked Questions

What is the difference between Levenshtein and Damerau–Levenshtein?

Damerau (here the optimal string alignment variant) also allows swapping two adjacent characters as a single edit, so "ab" to "ba" costs 1 instead of 2.

How is the similarity percentage calculated?

(1 − distance ÷ length of the longer text) × 100. Two empty strings are 100% similar.

When should I use Jaro–Winkler?

For short strings such as names, where matching beginnings matter more than endings. A score above about 0.9 usually means a likely match.

Why is the edit script empty for long texts?

The step list needs the full distance matrix and is only built when the product of the two lengths is at most one million. The metrics are still calculated.

Related Tools