Levenshtein Distance Calculator
Find the minimum number of edits needed to transform one string into another, with a full DP matrix and highlighted edit path.
Use the Levenshtein Distance Calculator
Strings to Compare
-
Edit Distance
-
Similarity
Insertions: -
Deletions: -
Substitutions: -
Enter two strings and click Compute to see the DP matrix.
Edit Path
DP Cost Matrix
Optimal path
Current cell
Matrix hidden — strings exceed 60 characters each. Distance is still correct above.
Copied!
Summary
The Levenshtein Distance Calculator finds the minimum number of single-character insertions, deletions, or substitutions required to change one string into another. It uses the classic dynamic programming algorithm and renders the full cost matrix so you can trace every edit step. Useful for fuzzy matching, spell-check tuning, diff tools, and NLP preprocessing.
How it works
- Enter the source string in the left input and the target string in the right input.
- The tool builds an (m+1) x (n+1) dynamic programming matrix in real time.
- Each cell stores the minimum edits needed to transform the substring up to that point.
- The bottom-right cell is the final Levenshtein distance between the two strings.
- The optimal edit path is highlighted in the matrix so you can trace each operation.
- Similarity percentage is computed as 1 minus (distance / max string length).
Use cases
- Tune fuzzy-search thresholds for autocomplete and spell-check features.
- Measure string similarity between database records for deduplication.
- Understand edit distance for NLP, DNA sequence alignment, and diff algorithms.
- Debug or visualize the DP matrix during algorithm learning.
- Compare usernames, product codes, or identifiers for near-duplicates.
- Estimate how many keystrokes a user made when mis-typing a password.
Frequently Asked Questions
Last updated: 2026-05-23 · Reviewed by Nham Vu