Levenshtein Distance Calculator
Work out levenshtein distance instantly with clear inputs, formula shown and shareable results.
About Levenshtein Distance Calculator
Levenshtein distance is the minimum number of single-character insertions, deletions or substitutions needed to turn one string into another, computed with a dynamic-programming table in O(mn) time. Dividing by the longer length gives a similarity ratio that is comparable across string lengths, which is what fuzzy matching, spell checking and record linkage use as a threshold.
Formula
Edit distance recurrence
D(x,y) = min(D(x-1,y) + 1, D(x,y-1) + 1, D(x-1,y-1) + cost) where cost is 0 when the characters match
Worked example
With the default values below, Levenshtein Distance Calculator returns Levenshtein distance of 3. Change any input above and every figure here is recalculated in your browser.
Inputs used
- First string
- kitten
- Second string
- sitting
Results
- Levenshtein distance
- 3
- Normalised similarity
- 57.14%
- Length of the longer string
- 7
- Normalised distance
- 0.4286
Step by step
- 1Values used
- 2Edit distance recurrence
- 3Levenshtein distance= 3
- 4Normalised similarity= 57.14
- 5Length of the longer string= 7
- 6Normalised distance= 0.4286
Assumptions and limits
- The result is derived only from the 2 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 4 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
How does this differ from Damerau-Levenshtein?
Damerau-Levenshtein also allows transposing two adjacent characters as a single edit, which better reflects typing errors such as teh for the.
What similarity threshold works for record matching?
Around 0.85 to 0.9 normalised similarity is a common starting point for names, but always calibrate against a labelled sample because it depends heavily on field length.
Related Calculators
- A B Test For Models Calculator
- Active Learning Sample Budget Calculator
- Adjusted Rand Index Calculator
- AI Project ROI Calculator
- AIC And BIC Calculator
- Annotation QA Sample Size Calculator
- Annotation Time Calculator
- Anomaly Threshold (Z Score) Calculator
- ARIMA Order Selection Calculator
- Automation Time Saved Calculator
You might also need
- AI Project ROI CalculatorAlso in AI, ML & Data Science
- Annotation Time CalculatorAlso in AI, ML & Data Science
- Distillation Speedup CalculatorAlso in AI, ML & Data Science
- Exponential Smoothing CalculatorAlso in AI, ML & Data Science
- FLOPs Estimate CalculatorAlso in AI, ML & Data Science
- Forecast Accuracy CalculatorAlso in AI, ML & Data Science
