Skip to contentScholarGate
LibraryBookshelfDeskReview StudioAssistant
Sign in
On this page
IntuitionHow it worksWhen to use itStrengths & limitationsCommon pitfallsApplicationsFrequently asked🔒 Read the full methodSourcesRelated methods
Cite this pageSpotted an issue on this page? Report or suggest a fix →
Home›Decision-making›Levenshtein Distance
MCDMString/sequence distance

Levenshtein Distance

Levenshtein Distance Metric · Also known as: edit distance, Damerau-Levenshtein distance

Levenshtein distance, also called edit distance, measures the minimum number of single-character edits (insertions, deletions, substitutions) needed to transform one string into another. Introduced by Vladimir Levenshtein in 1966, this metric is a true metric (satisfying all distance properties) and is fundamental in computational linguistics, spell checking, DNA sequence comparison, and record linkage. It ranges from 0 (identical strings) to the length of the longer string.

ScholarGate
  1. MCDM
  2. v1
  3. 2 Sources
  4. PUBLISHED
Cite this page →
Tools & resources
Download slides
Learn & explore

Read the full method

Members only

Sign in with a free account to read this section.

Sign in

Method map

The neighbourhood of related methods — select a node to explore.

Levenshtein Distance
Dynamic Time Warping

When to use it

Levenshtein distance is ideal for comparing strings or sequences of discrete symbols where edits are meaningful operations: spell checking, name matching, DNA sequence comparison, and approximate string matching. Use it when you need a true metric and can tolerate O(n*m) computation. For long strings or many comparisons, consider approximations or specialized algorithms (e.g., BK-trees for indexing).

Strengths & limitations

Strengths
  • True metric: satisfies all distance axioms including triangle inequality
  • Intuitive operation semantics: insertions, deletions, substitutions are meaningful edits
  • Well-established and widely used in NLP, bioinformatics, and record linkage
  • Variants (Damerau-Levenshtein, weighted edit distance) extend functionality
Limitations
  • Computationally expensive: O(n*m) time and space for strings of length n and m
  • Does not account for phonetic or semantic similarity; treats all substitutions equally
  • Not suitable for continuous data; requires discrete, symbol-based data
  • Can be dominated by a single large mismatch rather than many small ones

Frequently asked

What is the difference between Levenshtein and Hamming distance?

Hamming distance only works on strings of equal length and counts the number of differing positions. Levenshtein distance works on strings of any length and counts the minimum edit operations (insertions, deletions, substitutions). Levenshtein is more general.

Is Levenshtein distance case-sensitive?

By default, yes. 'Cat' and 'cat' have a Levenshtein distance of 1 (one substitution). Normalize case before comparison if case-insensitivity is desired.

Can I use custom costs for different edit operations?

Yes. The weighted (or restricted) edit distance allows different costs for insertions, deletions, and substitutions. Specify these costs in the dynamic programming matrix computation for domain-specific distance calculations.

How do I optimize Levenshtein distance for long strings?

Use space-efficient implementations (only store two rows instead of the full matrix). For searching within text, use BK-trees or other index structures. Consider approximate algorithms (e.g., approximate matching with early termination) if exact distances are not needed.

Sources

  1. Levenshtein, V. I. (1966). Binary codes capable of correcting deletions, insertions, and reversals. Soviet Physics Doklady, 10, 707-710. link ↗
  2. Damerau, F. J. (1964). A technique for computer detection and correction of spelling errors. Communications of the ACM, 7(3), 171-176. DOI: 10.1145/363958.363994 ↗

How to cite this page

ScholarGate. (2026, June 3). Levenshtein Distance Metric. ScholarGate. https://scholargate.app/en/decision-making/levenshtein-distance

Related methods

Dynamic Time Warping

Which method?

Set this method beside its closest kin and read them side by side — the library lays the books on the table; the choice is yours.

  • Dynamic Time WarpingDecision-making↔ compare
Compare side by side →

Referenced by

Dynamic Time Warping

Similar methods

Dynamic Time WarpingOptimal Matching AnalysisCosine DistanceSequence AlignmentDialectometryDIST-HAMMINGGower DistanceMachine learning-assisted sequence alignment

Related reference concepts

Sequence Alignment AlgorithmsTolerant and Wildcard RetrievalString AlgorithmsDynamic ProgrammingString MatchingError-Correcting Codes

Spotted an issue on this page? Report or suggest a fix →

ScholarGate — Levenshtein Distance (Levenshtein Distance Metric). Retrieved 2026-07-21 from https://scholargate.app/en/decision-making/levenshtein-distance · Dataset: https://doi.org/10.5281/zenodo.20539026
Quick facts
Originator
Vladimir Levenshtein
Subfamily
String/sequence distance
Year
1966
Type
Edit distance metric
Related methods
Dynamic Time Warping
ScholarGate

A content-first reference library for research methods — what each one is, how it works, and where it comes from.

Open data (CC-BY)

Explore

  • Library
  • Search the library…
  • Browse by field
  • Fields
  • Journey
  • Compare
  • Which method?

Reference

  • Subjects
  • Atlas
  • Glossary
  • Methodology
  • Philosophy

Your tools

  • Bookshelf
  • Desk
  • Chat

Company

  • About
  • Pricing
  • Contact
  • Suggest a method

Entries are compiled from published sources for reference. Verifying the accuracy and suitability of any information for your own use remains your responsibility.

© 2026 ScholarGate · A research-method reference library
  • Privacy
  • Cookies
  • Terms
  • Delete account