Skip to content
100% local

Levenshtein distance

Measure the edit distance between two strings, plus a similarity percentage.

Input
Compare with
Output

Levenshtein distance

The Levenshtein distance is the smallest number of single-character edits — insertions, deletions and substitutions — needed to turn one string into another. Paste a string on each side and this tool reports that distance, along with a normalized similarity ratio computed as (longest length minus distance) divided by the longest length: 100% means the two strings are identical, and the percentage falls as they diverge.

Edit distance is the metric behind spell-checkers, fuzzy search, deduplication and DNA sequence comparison. It answers "how far apart are these two values" in a way that a plain equality check can't — "kitten" and "sitting" differ by 3 edits, which is far closer than two unrelated words. Comparing product names, SKUs, headings or short user inputs for near-duplicates is exactly what it is built for.

Three options tune the comparison. Ignore case treats "Hello" and "hello" as equal. Trim whitespace strips leading and trailing spaces from each side before comparing. Compare by lets you switch from characters to words: word mode measures how many whole words must change, which is the right unit for comparing sentences rather than tokens. Very long inputs are handled safely — because the calculation grows with the product of the two lengths, extremely large pairs return a short notice instead of freezing the tab.

Everything runs locally in your browser. The two strings are never uploaded, so comparing confidential names, keys or unpublished text is completely private.

FAQ

What is the Levenshtein distance?
It is the minimum number of single-character edits — insertions, deletions or substitutions — needed to change the first string into the second. Turning "kitten" into "sitting" takes 3 edits, so the distance is 3.
How is the similarity percentage calculated?
It is the length of the longer string minus the edit distance, divided by that length, shown as a percentage. Identical strings score 100%; two completely different strings of equal length score 0%.
What is the difference between comparing by characters and by words?
Character mode counts single-character edits, which suits short strings and typo detection. Word mode treats each whole word as one unit, so it measures how many words changed — better for comparing sentences or phrases.
Is there a limit on input size?
The calculation grows with the product of both lengths, so extremely large pairs would freeze the tab. When that limit is reached the tool shows a short notice asking you to shorten the inputs rather than trying to compute.
Is my text uploaded anywhere?
No. The comparison runs entirely in your browser with no network requests, so both strings stay on your device.