Levenshtein Distance Calculator
Compare two short text strings by insertions, deletions and substitutions, with a deterministic edit script and normalized similarity.
YOUR CALCULATION
Result
—
Calculation steps
Work through one step at a time or reveal the complete calculation. The steps use your current inputs.
How to calculate
Split each input into Unicode code points and fill the dynamic-programming matrix whose cell is the minimum cost of deleting, inserting or substituting the next character. Backtrack one minimum path for the displayed edit script.
D(i,j)=min[D(i−1,j)+1, D(i,j−1)+1, D(i−1,j−1)+cost]; similarity=1−distance/max(lengths)
Worked example
“kitten” and “sitting” have distance 3: substitute k→s, substitute e→i and insert g. Their normalized similarity is 1−3/7≈0.571429.
Assumptions and input details
Each input must contain 1–200 Unicode code points. A substitution, insertion or deletion costs one; transposition is not a single edit. The optional case-insensitive mode uses Unicode lowercase conversion but does not perform locale-specific collation, accent folding, semantic comparison or spell correction. One minimum edit script is shown when several exist.
References: NIST Dictionary of Algorithms and Data Structures: Levenshtein distance
Using this calculator
Can I enter my own problem?
Yes. Replace the example values with your own inputs. The result, calculation steps, tables and applicable diagrams update from those inputs. Blank or invalid values clear the result; example values are never silently substituted for missing inputs.
Are the results exact?
Results use floating-point arithmetic and displayed rounding. Read the formula, assumptions and any stated data precision before interpreting the result.
Is my input uploaded?
The calculation runs in your browser. No account, file upload or external AI service is required. Inputs are not saved between page reloads.
Count UTF-8 bytes, UTF-16 units, Unicode code points and grapheme clusters with explicit text transformations.
Estimate reading and presentation duration from an entered word count, independent words-per-minute speeds and explicit pauses.
Encode four data bits or inspect a seven/eight-bit Hamming codeword under explicit error-count assumptions.
Reserved advertising space.