Levenshtein Distance Calculator
NewCompute the Levenshtein edit distance and similarity percentage between two strings, showing how many insertions, deletions, or substitutions separate them.
Edit distance
—
Similarity
—
Levenshtein distance is the minimum number of single-character insertions, deletions, or substitutions needed to turn String A into String B — it's widely used for fuzzy matching, spell-check suggestions, and detecting near-duplicate strings.
Frequently Asked Questions
What exactly does Levenshtein distance measure?
It's the minimum number of single-character edits — insertions, deletions, or substitutions — required to transform one string into the other; a distance of 0 means the strings are identical, and higher numbers mean more edits are needed.
How is the similarity percentage calculated?
It's computed as `(1 - distance / max(lengthA, lengthB)) * 100`, giving an intuitive 0-100% scale where identical strings score 100% and completely unrelated strings of similar length score close to 0%.
What is this algorithm typically used for?
Spell-checkers use it to suggest corrections for misspelled words, fuzzy search and deduplication systems use it to find near-duplicate records, and DNA/text-diffing tools use it as a foundational similarity metric.
Is the comparison case-sensitive?
Yes — "Kitten" and "kitten" are treated as different at the first character, so if you want a case-insensitive comparison, lowercase both inputs before pasting them in.
Why does "kitten" → "sitting" have a distance of 3?
It requires substituting "k" for "s", substituting "e" for "i", and inserting a "g" at the end — three edits total, which is the classic textbook example used to introduce the Levenshtein distance algorithm.