All tools

Levenshtein / String Distance Calculator

Text

Compute the edit distance and similarity ratio between two strings

Enter two strings and get the Levenshtein edit distance between them, the minimum number of single-character insertions, deletions, and substitutions needed to turn one into the other, plus a normalized 0-1 similarity ratio. Switch to Damerau mode to also count an adjacent-character transposition (like swapping 'ab' to 'ba') as a single edit instead of two. Reach for this when building fuzzy search, typo tolerance, deduplication thresholds, or spell-check suggestions, anywhere you need a numeric measure of how close two strings are rather than a line-by-line diff.

levenshteinstring-distanceedit-distancesimilarityfuzzy-match

How to use Levenshtein / String Distance Calculator

  • 1.Type or paste the two strings you want to compare into the A and B fields.
  • 2.Pick Levenshtein (default) or Damerau mode depending on whether adjacent-character swaps should count as one edit or two.
  • 3.Read the edit distance, similarity percentage, and the length of the longer string from the result cards.

Frequently asked questions

What's the difference between Levenshtein and Damerau mode here?
Levenshtein mode only counts insertions, deletions, and substitutions. Damerau mode additionally counts one adjacent-character transposition (e.g. 'ab' to 'ba') as a single edit instead of two substitutions. This is the optimal-string-alignment variant, not unrestricted Damerau-Levenshtein, so it assumes each substring is edited at most once.
How is the similarity percentage calculated?
Similarity is 1 minus the edit distance divided by the length of the longer string, expressed as a percentage. Two identical strings score 100%; two strings with nothing in common score close to 0%.
Is there a length limit?
Yes, each string is capped at 5,000 characters. The algorithm is O(n*m), so much longer inputs would be slow and are rarely what you want for a string-distance comparison anyway.
Does this diff two documents line by line?
No. For a line-level diff of two files or code blocks, use the Text Diff tool instead. This tool measures character-level edit distance between two short strings, the building block for fuzzy matching and typo detection.

Use via API, SDK, or MCP

cURL# Free: 1,000 req/day · Pro: 10,000 req/day
curl -X POST https://api.utilix.tech/v1/tools/string-distance \
  -H "Authorization: Bearer utx_live_..." \
  -H "Content-Type: application/json" \
  -d '{"a":"kitten","b":"sitting","mode":"levenshtein","caseSensitive":true}'

Get an API key from your dashboard · Full API docs →