Skip to main content
Text tools100% FreeInstant

String Distance Calculator: Levenshtein, Hamming, Jaro-Winkler

This free tool measures how different two strings are. It gives the Levenshtein edit distance, the Hamming distance, the Jaro and Jaro-Winkler similarity and a simple similarity percentage.

By Debmedia Technologies LLP · Kolkata, India · Updated

What Is It and When Do You Need It?

String distance tells you how close two words are. It is used in spell checkers, search, duplicate detection and DNA comparison.

Type two strings and read all the measures.

How to Use This Tool

  1. Enter or paste your input in the box or boxes above.
  2. Choose the options, if there are any.
  3. Press the button to run the tool.
  4. Read the result and use the copy button where one is shown.

How the Calculation Works

Levenshtein is worked out with dynamic programming on a table of prefixes. Hamming counts different positions. Jaro counts matching characters within half the length of the longer string and the transpositions between them. Jaro-Winkler adds a bonus of 0.1 per shared first letter up to four. The similarity percentage is 1 minus the Levenshtein distance divided by the longer length.

Worked Example

kitten and sitting have a Levenshtein distance of 3. martha and marhta have a Jaro-Winkler score of 0.9611.

Common Uses

  • Finding typos and near duplicates.
  • Matching names.
  • Teaching algorithms.
  • Comparing DNA strings.

Tips and Common Mistakes

  • Convert both strings to the same case first if case should not matter.
  • Long strings are limited to 5,000 characters.
  • Spaces count as characters.
  • Check the first result against a case you already know, so you can trust the tool for the rest.
  • Nothing you type leaves your device. The work is done by your browser, so it also works with a slow connection once the page has loaded.

Next, you may need the text diff checker, Soundex generator, character counter, text repeater.

Everything runs in your browser. Nothing you type is uploaded, stored or sent to any outside service.

Frequently Asked Questions

The least number of single-character inserts, deletes and changes needed to turn one string into the other. kitten to sitting is 3.
The number of positions where two strings of the same length differ. It is not defined for strings of different length.
A score from 0 to 1 that rewards strings which share letters in nearly the same order and which start the same way. It suits names.
Yes. Capital and small letters count as different characters.

Disclaimer: results are calculated in your browser from the numbers you enter. Check important results before you rely on them for money, health, safety or legal decisions.