Levenshtein Distance Calculator
Calculate the edit distance between two strings, with the full dynamic-programming matrix, plus Damerau-Levenshtein, Jaro-Winkler and Dice scores.
Result
Type into both boxes to see the edit distance, the related string metrics and the dynamic-programming matrix.
What is the Levenshtein Distance Calculator?
Levenshtein distance is the minimum number of single-character insertions, deletions and substitutions needed to turn one string into another.
- Classic O(m·n) dynamic-programming edit distance
- Full matrix drawn cell by cell with the cheapest path highlighted
- Also reports Damerau-Levenshtein, Hamming, Jaro, Jaro-Winkler and Dice
- Normalised similarity percentage for comparing strings of different lengths
- Options to ignore case and collapse whitespace before comparing
- Operates on Unicode code points so emoji count as a single edit
How to use the Levenshtein Distance Calculator
- 1
Type or paste your two strings into the first and second boxes.
- 2
Tick “Ignore letter case” or “Collapse runs of whitespace” if those differences should not count.
- 3
Read the distance and similarity figures in the stat tiles.
- 4
For strings of up to 18 characters each, study the edit-distance matrix with its highlighted cheapest path.
- 5
Press “Copy report” to take every metric with you.
About the Levenshtein Distance Calculator
Levenshtein distance is the minimum number of single-character insertions, deletions and substitutions needed to turn one string into another. Turning “kitten” into “sitting” takes three edits, so their Levenshtein distance is 3. It is the metric behind spell-checkers, fuzzy search, record deduplication and DNA sequence alignment.
This calculator runs the classic O(m·n) dynamic-programming algorithm and, for short inputs, draws the whole matrix cell by cell with one cheapest path highlighted so you can see exactly where the edits happen. Alongside it you get Damerau-Levenshtein (which treats a transposition of two adjacent characters as one edit), Hamming distance, Jaro and Jaro-Winkler similarity, the Sørensen-Dice bigram coefficient and a normalised similarity percentage.
All the metrics operate on Unicode code points rather than UTF-16 units, so an emoji costs one edit instead of two. Everything is computed in your browser and nothing is uploaded, which makes it safe for customer names and other private data.
Frequently asked questions
What is the Levenshtein distance between kitten and sitting?
It is 3: substitute k for s, substitute e for i, and insert a g at the end. That worked example is the standard illustration of the algorithm, and you can watch it play out in the matrix on this page.
What is the difference between Levenshtein and Damerau-Levenshtein?
Damerau-Levenshtein adds a fourth operation: swapping two adjacent characters counts as one edit rather than two. That makes it better at scoring typos, since transposing letters is one of the most common mistakes people make. This tool uses the optimal string alignment variant.
When should I use Jaro-Winkler instead?
Jaro-Winkler is a similarity score from 0 to 1 that rewards strings sharing a prefix, which makes it well suited to matching people's names. Levenshtein is a count of edits, so it is better when you need to know how much work a transformation takes.
Why is the Hamming distance shown as a dash?
Because Hamming distance is only defined for strings of equal length. When your two inputs differ in length there is no valid answer, so the tool shows a dash rather than an invented number.
Why does the matrix disappear for long strings?
The matrix has one cell for every pair of positions, so it becomes unreadable and slow beyond about 18 characters per side. The distances themselves are still calculated for inputs up to 1200 characters — only the drawing is skipped.
Related tools
Hamming Distance Calculator
Count the positions where two equal-length strings, binary values or hex values differ. Shows a position-by-position diff, normalised distance and similarity.
Soundex & Metaphone Calculator
Encode names phonetically with American Soundex, Refined Soundex, NYSIIS and Metaphone, and compare two names side by side for a sound-alike verdict.
Text Compare
Compare two texts online free and highlight every difference. A private text comparison tool that finds matches and changes right in your browser.
Keyboard Layout Converter
Recover text typed with the wrong keyboard layout active. Remaps between QWERTY, Dvorak, Colemak, AZERTY, QWERTZ and ЙЦУКЕН by key position.
Text Entropy Calculator
Calculate Shannon entropy in bits per character, word or byte. Shows maximum entropy, redundancy and a full symbol probability table.