Damerau–Levenshtein Distance Calculator
Calculate the Damerau-Levenshtein edit distance between two strings, counting insertions, deletions, substitutions and adjacent transpositions (optimal string alignment variant).
Description
Count insertions, deletions, substitutions, and adjacent transpositions using the optimal-string-alignment variant.
Damerau-Levenshtein Distance Calculator count insertions, deletions, substitutions, and adjacent transpositions using the optimal-string-alignment variant.
Use this for typo-tolerant matching when swapped adjacent characters such as recieve versus receive should count as one edit.
When to use Damerau-Levenshtein Distance Calculator
Use this for typo-tolerant matching when swapped adjacent characters such as recieve versus receive should count as one edit.
How it works
Dynamic programming finds the minimum edit cost, adding an adjacent-transposition option when neighboring symbols cross. Unicode code points, rather than UTF-16 code units, are compared.1
Interpreting the result
Keep the input units, direction conventions, encoding, and ordering rules visible when reusing the result. Preserve the full returned value for downstream calculations and round only for presentation.
Assumptions and limitations
Optimal string alignment restricts each substring to one edit and can differ from unrestricted Damerau-Levenshtein distance. Costs are uniform and text is not case-folded or normalized automatically.
References
-
A technique for computer detection and correction of spelling errors — Communications of the ACM