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.

Strings to Compare

Enter two strings and click Compute to see the DP matrix.

Copied!

Summary

Find the minimum number of edits needed to transform one string into another, with a full DP matrix and highlighted edit path.

How it works

  1. Enter the source string in the left input and the target string in the right input.
  2. The tool builds an (m+1) x (n+1) dynamic programming matrix in real time.
  3. Each cell stores the minimum edits needed to transform the substring up to that point.
  4. The bottom-right cell is the final Levenshtein distance between the two strings.
  5. The optimal edit path is highlighted in the matrix so you can trace each operation.
  6. 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-06-13 · Reviewed by Nham Vu