Levenshtein distance, also called edit distance, counts the minimum number of single-character insertions, deletions, and substitutions needed to change one string into another.
For example, the distance between kitten and sitting is 3:
- Substitute
kwiths. - Substitute
ewithi. - Add
gat the end.
From distance to similarity
Raw edit distance grows with the length of the strings. A matching tool can normalize it into a similarity score where 100% means identical values.
A threshold controls the result:
- A high threshold returns fewer, closer matches.
- A lower threshold finds more typo variants and more false positives.
Levenshtein works well for misspellings, missing characters, and small edits in names, addresses, company names, or product titles. It does not understand meaning or identity.
How Datablist converts Levenshtein distance to similarity
Datablist trims surrounding whitespace and lowercases the two values before comparison. It divides the edit distance by their average character length:
similarity = 1 - edit distance / ((length A + length B) / 2)
For Acme and Acne, one substitution changes m to n. Both strings have
four characters, so similarity is 1 - 1 / 4 = 0.75, or 75%. A threshold of
80% rejects this pair; 70% accepts it as a candidate.
For kitten and sitting, the edit distance of 3 and average length of 6.5
produce about 53.85% similarity. Another library may normalize by the longer
string instead and return a different score for the same pair. Compare the
normalization rule before reusing a threshold.
Does Levenshtein treat swapped letters as one edit?
No. Standard Levenshtein uses insertions, deletions, and substitutions. Changing
Martha to Marhta takes two substitutions. Damerau-Levenshtein adds an
adjacent-transposition operation; it is a different algorithm from Datablist's
Levenshtein distance option.
Set thresholds using examples of both duplicates and different records. A short name with one changed letter can lose a large share of its score; longer strings can remain similar despite a meaningful difference. A score measures text similarity, not record identity.
Levenshtein compared with Jaro-Winkler
Levenshtein measures the number of edits across the whole string. Jaro-Winkler gives more weight to a shared prefix and can be useful for short names.
Neither algorithm should be the default for emails, domains, IDs, or phone numbers. Use Exact or a data-specific Smart processor for those identifiers.
Use Levenshtein in Datablist
In the Duplicates Finder, select a text property, choose Distance (Levenshtein or Jaro Winkler), then select Levenshtein distance and set the similarity threshold. Distance matching is available on paid plans.
The tested name workflow in the list deduplication guide uses Levenshtein at 90% and shows why name-only groups still need review. See the Duplicate Finder reference for the complete settings.