Levenshtein Distance (Edit Distance) Calculator
Calculate the minimum number of single-character edits (insertions, deletions, substitutions) required to transform one string into another. Includes similarity percentage.
Results
What is it?
The Levenshtein distance is the minimum number of single-character edits (insert, delete, or substitute one character) needed to change one string into another. It is the foundation of spell-checkers, DNA sequence alignment, fuzzy search, and plagiarism detection. Similarity = 1 − (distance / max_length). Example: "kitten" → "sitting" = distance 3, similarity = 1 − 3/7 = 57%.
How to use
Since computing Levenshtein distance requires a dynamic programming algorithm running in the browser (which this formula-based calculator cannot execute), enter the string lengths and the edit distance computed by your own implementation or a reference tool. The calculator then gives the similarity percentage and normalised distance. For common word pairs, the guide below provides worked examples.
Example scenario
"kitten" (length 7) → "sitting" (length 8). Operations: k→s (sub), e→i (sub), insert g at end = 3 edits. Max length = 8. Similarity = (1 − 3/8) × 100 = 62.5%. In spell-checking, words with distance ≤ 2 are typically suggested as corrections.
Pro tip
Levenshtein distance = O(m×n) time complexity where m, n are string lengths — computationally feasible for short strings but expensive for long documents. For large-scale fuzzy matching, use approximate string matching libraries (Rapidfuzz, FuzzyWuzzy in Python; fuse.js in JavaScript). The Jaro-Winkler distance gives higher weight to prefix matches and is better for name deduplication.