Levenshtein Distance
Compute edit distance and similarity ratio between two text files.
About Levenshtein Distance
Levenshtein Distance measures how many single-character edits — insertions, deletions, or substitutions — it takes to turn one string into another, and reports a similarity ratio alongside the raw count. Reach for it when you need a numeric measure of how close two texts are, rather than a line-by-line diff view. Both strings are compared entirely in your browser, so nothing you paste is uploaded anywhere.
- Category
- text
- Input
- Accepts: text/plain.
- Output
- Outputs: application/json.
- Cost
- Free, runs in your browser
- Memory
- low
Common uses
- Score how close a user's typed answer is to the expected answer in a quiz or spell-checker prototype
- Detect near-duplicate product names or customer records that differ only by a typo or two
- Decide whether two OCR passes of the same scanned page agree closely enough to trust
- Tune a fuzzy-match threshold by reading the exact edit distance between known good and bad pairs
- Quantify how much a translation or paraphrase drifted from the original wording
- Compare two versions of a short config value or commit message to confirm they are effectively identical
Frequently asked questions
What does the similarity ratio mean?
It is a normalized score between 0 and 1 derived from the edit distance relative to the longer string. 1.0 means the two texts are identical; values near 0 mean they share almost nothing.
Is this the same as a regular text diff?
No. A text diff shows you which lines or chunks changed; Levenshtein gives you a single number describing how different two strings are. Use Text Diff when you want to see the changes, and this tool when you want to measure them.
Does it count whole words or individual characters?
It operates at the character level — each inserted, deleted, or substituted character counts as one edit. That makes it sensitive to small typos rather than reordered words.
Is there a length limit?
There is no hard cap, but edit distance is computed in roughly proportional-to-length-squared time, so very large inputs (tens of thousands of characters) will get noticeably slower. It is built for words, names, sentences, and short passages.
Does my text get uploaded?
No. The comparison runs locally in your browser. Neither string leaves your device, which makes it safe for names, records, or anything sensitive.
Keywords
- levenshtein
- edit distance
- diff
- similarity
- compare
- fuzzy
- string