EN
My tools

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.

Levenshtein distance
3
Similarity
57.14%
1 − 3 ÷ 7
Length of first / second
6 / 7 characters
Edits

Characters are compared as Unicode code points, so an emoji or a Hangul syllable counts as one character.

Edits that turn the first string into the second (positions in the first)
#EditPositionFromTo
1Substitute1ks
2Substitute5ei
3Insert7g
Dynamic-programming table (cell = distance between the prefixes)
εsitting
ε01234567
k11234567
i22123456
t33212345
t44321234
e55432234
n66543323
My tools →
Advertisement

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

  1. Type the two strings (or a string and a list, one candidate per line).
  2. Choose plain Levenshtein, or Damerau to count swapped neighbours as one edit.
  3. Optionally ignore case and whitespace, or compare whole words.
  4. 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:

Cite or embed this tool
APA

kakaoCalc. (2026, November 8). Levenshtein Distance Calculator (Edit Distance). https://kakao.mobile/tools/levenshtein-distance-tool/

MLA

“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

Advertisement