Levenshtein Distance Calculator (Edit Distance)
Levenshtein edit distance and similarity between two strings, with Damerau transpositions, the list of edits, the DP matrix, and ranking against a list.
Characters are compared as Unicode code points, so an emoji or a Hangul syllable counts as one character.
| # | Edit | Position | From | To |
|---|---|---|---|---|
| 1 | Substitute | 1 | k | s |
| 2 | Substitute | 5 | e | i |
| 3 | Insert | 7 | g |
| ε | s | i | t | t | i | n | g | |
|---|---|---|---|---|---|---|---|---|
| ε | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| k | 1 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| i | 2 | 2 | 1 | 2 | 3 | 4 | 5 | 6 |
| t | 3 | 3 | 2 | 1 | 2 | 3 | 4 | 5 |
| t | 4 | 4 | 3 | 2 | 1 | 2 | 3 | 4 |
| e | 5 | 5 | 4 | 3 | 2 | 2 | 3 | 4 |
| n | 6 | 6 | 5 | 4 | 3 | 3 | 2 | 3 |
The Levenshtein distance is the smallest number of single-character insertions, deletions and substitutions that turn one string into another — the measure behind spelling suggestions, fuzzy search, duplicate detection and DNA alignment. This calculator gives the distance and a similarity percentage, lists the actual edits, shows the dynamic-programming table for short strings, and can rank a whole list of candidates by how close they are to your string.
How to use this tool
- Type the two strings (or a string and a list, one candidate per line).
- Choose plain Levenshtein, or Damerau to count swapped neighbours as one edit.
- Optionally ignore case and whitespace, or compare whole words.
- Read the distance, the similarity and the edits; the table appears for strings up to 20 characters.
Formula
d[i][j] = min(d[i−1][j] + 1, d[i][j−1] + 1, d[i−1][j−1] + (aᵢ ≠ bⱼ)) · similarity = 1 − d ÷ max(|a|, |b|)
d[i][j] is the distance between the first i characters of a and the first j characters of b, starting from d[i][0] = i and d[0][j] = j. The adjacent-swap (optimal string alignment) variant adds d[i−2][j−2] + 1 when two neighbours are swapped, but never edits a substring twice; the unrestricted Damerau–Levenshtein distance drops that restriction (CA → ABC is 2 instead of 3). Characters are Unicode code points; words are separated by whitespace.
Example
kitten → sitting = 3: substitute k → s, substitute e → i and insert g at the end. The longer string has 7 characters, so the similarity is 1 − 3/7 = 57.14%. flaw → lawn is 2 (delete f, insert n). Ranking the list kitchen, mitten, sitting and kitty against kitten puts mitten first, at distance 1.
Frequently asked questions
What is the difference between Levenshtein and Damerau–Levenshtein?
Damerau also counts swapping two neighbouring characters (teh → the) as one edit, which matches common typing mistakes. Plain Levenshtein needs two substitutions for that.
Is similarity a standard measure?
1 − distance ÷ longer length is the usual normalisation, but others exist (for example dividing by the sum of lengths). Use the same one when comparing scores.
How long can the strings be?
Up to a few thousand characters each; the calculation grows with the product of the two lengths. The step table is shown for strings of up to 20 characters.
Sources
Last updated:
Page address with these inputs: https://kakao.mobile/tools/levenshtein-distance-tool/
Cite or embed this tool
kakaoCalc. (2026, November 8). Levenshtein Distance Calculator (Edit Distance). https://kakao.mobile/tools/levenshtein-distance-tool/
“Levenshtein Distance Calculator (Edit Distance).” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/levenshtein-distance-tool/.
Paste this code into your page. The widget runs in your visitors' browsers, shows no ads and keeps a link back to this page. Embedding terms