FreeToGenerate.com

Seven answers to one question, because they are not the same question.

Two strings, every measure

MeasureScoreEdits
Levenshtein0.6672
Damerau-Levenshtein0.8331
Jaro0.944
Jaro-Winkler0.961
Dice0.400
Jaccard0.250
Longest common subsequence0.833

Edits is the raw distance before it is turned into a score: the number of single-character changes needed. The other measures do not count edits at all.

0.711

The spread between the highest and lowest score here is the point. These are different questions, not different spellings of one answer.

Which is the closest match?

MeasureTop pickScore
Levenshteinrelieve0.857
Damerau-Levenshteinreceive0.857
Jaroreceive0.952
Jaro-Winklerreceive0.967
Dicerelieve0.667
Jaccardrelieve0.500
Longest common subsequencereceive0.857

2 distinct winners among the measures, from one list.

Levenshtein
The fewest insertions, deletions and substitutions that turn one string into the other, divided by the longer string.
Damerau-Levenshtein
The same, plus swapping two adjacent characters as a single edit. It is why a spell-checker treats hte as one typo away from the rather than two.
Jaro
Matching characters within a window of half the longer string, penalised for how many of those matches are out of order.
Jaro-Winkler
Jaro with a bonus for agreeing on the first few characters, because the names it was built for are misspelled at the end far more often than at the start.
Dice
Twice the shared adjacent letter pairs over the total number of pairs. Word order inside a pair matters; position in the string does not.
Jaccard
The shared adjacent letter pairs over the union of them. It ranks the same way Dice does but always scores lower.
Longest common subsequence
The longest run of characters appearing in both strings in the same order, though not necessarily next to each other, over the longer string.

Everything is computed in your browser over code points, so an emoji counts as one character rather than two. Jaro and Jaro-Winkler reproduce the figures published with their definitions.

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

  1. 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.
  2. 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.
  3. 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.