Also available in: Español · Português · Français · العربية
Text Similarity: Seven Measures, Side by Side
Every common string similarity measure computed at once, so you can see which one your problem actually needs.
What is text similarity?
Text similarity is a number saying how alike two strings are, usually scaled so 1 means identical and 0 means nothing in common. It is what sits underneath fuzzy search, deduplicating a customer list, catching a typo in a product code, and matching a name typed by a human against a name stored by a database.
The trouble is that there is no single definition. Levenshtein counts how many single-character edits separate the two. Jaro counts matching characters and how badly they are out of order. Dice and Jaccard ignore position entirely and compare sets of adjacent letter pairs. Longest common subsequence asks how much of one string survives inside the other in order. These are different questions, and they give different answers.
This page computes seven of them at once rather than picking one for you, because picking one is the actual decision and it is usually made by accident.
How to use it
- Put two strings in the top boxes. Every measure scores the pair immediately, with the raw edit count shown beside the two distance-based ones.
- Then try the ranking panel. Give it something to look for and a list of candidates, one per line. Each measure ranks the list on its own and reports its winner.
- Watch the winners disagree. The line under that table counts how many distinct answers came out of one list. When it says more than one, the measure you would have picked was doing real work.
How much they disagree, measured
This is not a theoretical worry. Taking this site's own source code as a corpus and drawing random triples of camelCase identifiers, Levenshtein ratio and Jaro-Winkler put the same two candidates in a different order 27.7% of the time across 3,479 pairs. Against the Ratcliff/Obershelp measure that Python's difflib uses, Levenshtein disagrees on 25.5%.
The effect is worse in the case people actually build: picking the single nearest match out of a list. Choosing from a pool of 400 candidates, Levenshtein and Jaro-Winkler named a different winner for 62% of queries. That figure depends on how big the pool is, so treat the 27.7% as the honest headline and this one as a demonstration of which direction it moves.
The default example on this page is the classic case. Ask for the misspelling recieve among receive, relieve, reprieve, retrieve and recipe. Plain Levenshtein prefers relieve, because that is one substitution away while receive is two edits — the letters were transposed, and Levenshtein has no concept of a transposition. Damerau-Levenshtein, which counts swapping two adjacent characters as a single edit, scores receive and relieve identically at 0.857 and picks the first of the two. Jaro-Winkler ranks receive strictly highest at 0.967. Three behaviours from one list, and only one of them gets the word you meant.
Which one should you use?
For human typing errors, Damerau-Levenshtein is usually the better default than plain Levenshtein, because transposing two letters is one of the commonest mistakes and Levenshtein charges double for it. For names, Jaro-Winkler was designed for exactly that job at the US Census Bureau, and its prefix bonus reflects that people get the start of a name right far more often than the end.
For longer text where whole words move around, the set-based measures do better. Dice and Jaccard compare bags of adjacent letter pairs, so reordering matters much less to them, and they rank identically to one another — Jaccard just always scores lower for the same pair, which surprises people comparing thresholds copied from different sources.
The one honest generalisation is that a threshold is not transferable. A cutoff of 0.8 means something quite different under Jaccard than under Jaro-Winkler, and for the MARTHA and MARHTA pair loaded above the scores run from 0.250 to 0.961 depending on which measure you ask. Any threshold you inherit from a blog post is attached to a measure, and the measure is usually not stated.
What this page cannot tell you
None of these measures understands meaning. Cat and feline score close to zero; colour and color score high. If you need to know that two sentences say the same thing in different words, string similarity is the wrong tool entirely and no threshold will rescue it.
They are also character-based, and character means code point here rather than what you would call a letter. That fixes the common bug where an emoji counts as two characters and two different emoji come out two edits apart, but it stops short of grapheme clusters — a flag or a skin-toned emoji is still several code points, and the classic definitions of these measures do not address that.
Finally, the ranking panel resolves ties by input order. When two candidates score identically, the one higher in your list wins, which is a property of this tool rather than of the measure. The scores are shown so you can see when that has happened.
Why is it free?
All seven measures are a few dozen lines of arithmetic that run in your browser. Nothing you type is uploaded, nothing is logged, and there is no account to make.
No sign-up, no limits, and no watermark on anything you copy out.