Skip to content
gohacks.dev
Tooling

String Similarity Calculator

Compare two strings by Levenshtein edit distance, word-level edit distance, Jaro-Winkler, Dice on character pairs, Jaccard on words and longest common subsequence.

Free · No sign-up · Your inputs stay in your browser

Input

Compare two strings (Levenshtein, Jaro-Winkler and more)

Output

64.0% similar by edit distance

Levenshtein distance9 edits (64.0%)
Word-level edit distance3 words
Jaro-Winkler0.8622
Dice coefficient (bigrams)82.6%
Jaccard (words)66.7%
Longest common subsequence17 characters

Levenshtein counts single-character insertions, deletions and substitutions; it is what fuzzy search and 'did you mean' suggestions are built on (PHP has levenshtein() and similar_text()). Jaro-Winkler rewards a shared prefix and suits short strings such as names. Dice on character pairs and Jaccard on words ignore order, so they recognise reordered phrases that edit distance scores as very different.

Runs in this browser. Nothing you paste is sent to a server.

Which measure to use

Levenshtein suits typos and short strings, and is what fuzzy search and "did you mean" are built on; PHP has levenshtein() built in. Jaro-Winkler rewards a common prefix and is used for matching names. Dice and Jaccard ignore word order, so they recognise "kitten on the mat" and "on the mat, kitten" as close where edit distance does not.

Performance

Levenshtein costs time proportional to the product of the lengths, fine for names and titles, slow for documents. For large-scale fuzzy matching, databases offer trigram indexes, such as PostgreSQL's pg_trgm.

Share

Frequently asked questions

What is Levenshtein distance?
The minimum number of single-character insertions, deletions and substitutions to turn one string into the other. kitten to sitting is 3.
How do I do fuzzy matching in SQL?
PostgreSQL's pg_trgm and fuzzystrmatch extensions provide similarity() and levenshtein(); MySQL users usually move it to a search engine or the application.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools