Part of the AI & Machine Learning suite · 24 calculators

Edit Distance Calculator

The Levenshtein edit distance between two strings — the fewest single-character insertions, deletions and substitutions to turn one into the other — with the normalised similarity, the operation counts and the alignment.

Edit distance is computed by dynamic programming: a grid where each cell holds the cheapest way to match a prefix of one string with a prefix of the other.

Results update as you type
Results
Edit distance
3
Similarity
Substitutions
Insertions
Deletions
Lengths
Edits
Reading
Reviewed September 2026. Model arithmetic is the same everywhere: the same formulas in every market, in your own currency. The UK regulates AI through existing sector regulators rather than a single AI statute.
No account required · Google Analytics off unless allowedCalculator arithmetic runs in your browserResults update as you type
All calculations run 100% in your browser. The calculator code does not submit your figures to GlobalCalc to obtain a result.
About edit distance

How the edit distance calculator works

Edit distance is computed by dynamic programming: a grid where each cell holds the cheapest way to match a prefix of one string with a prefix of the other. The bottom-right cell is the answer, and walking back through the grid recovers which edits were made.

It is the workhorse of spell-checking, fuzzy matching, deduplication and word error rate. Normalised by the longer string it becomes a similarity from 0 to 1, which is what a matching threshold is set against.

Formula: d[i][j] = min(d[i−1][j] + 1, d[i][j−1] + 1, d[i−1][j−1] + [aᵢ ≠ bⱼ]); similarity = 1 − d / max(|a|, |b|)

Worked examples

InputsEdit distanceNote
kitten to sitting3the textbook 3
A typo2two edits
Unrelated5five

Frequently asked questions

What is Levenshtein distance?

The minimum number of single-character insertions, deletions or substitutions that turn one string into another. "kitten" to "sitting" is three.

What is it used for?

Spell-checking, fuzzy search, record matching and deduplication, DNA sequence comparison, and word error rate for speech — anything that needs "how different are these".

How is similarity defined?

One minus the distance divided by the longer string's length. It runs from 0 to 1; a threshold of about 0.8 is a common fuzzy-match cut-off.

Is it the same as Damerau–Levenshtein?

Damerau adds transposition of adjacent characters as a single edit, so "ab" to "ba" costs one instead of two. This page is plain Levenshtein.

Why the 400-character limit?

The algorithm builds a grid of both lengths multiplied, which is fine for words and short lines. For documents use a diff tool or a token-level distance.

Where these figures come from

Last checked: September 2026. The relationships here are architectural, not vendor-specific: bytes per parameter follow the numeric format, KV-cache size follows the transformer definition, and token-per-word ratios come from published tokeniser behaviour.