EditDistance
✖
EditDistance
gives the edit or Levenshtein distance between strings, vectors or biomolecular sequences u and v.
Details and Options

- EditDistance[u,v] gives the number of one-element deletions, insertions, and substitutions required to transform u to v.
- For strings, setting the option IgnoreCase->True makes EditDistance treat lower‐ and upper‐case letters as equivalent.
Examples
open allclose allBasic Examples (3)Summary of the most common use cases
Edit distance between two strings:

https://wolfram.com/xid/0puyldih26-x5h86

Edit distance between two vectors:

https://wolfram.com/xid/0puyldih26-csh1ij

Edit distance between biomolecular sequences:

https://wolfram.com/xid/0puyldih26-68147z

Scope (2)Survey of the scope of standard use cases
Options (1)Common values & functionality for each option
Applications (2)Sample problems that can be solved with this function
Properties & Relations (2)Properties of the function, and connections to other functions
EditDistance is less than or equal to HammingDistance for strings of equal length:

https://wolfram.com/xid/0puyldih26-8k3np


https://wolfram.com/xid/0puyldih26-btvig

EditDistance is less than or equal to HammingDistance for vectors of equal length:

https://wolfram.com/xid/0puyldih26-byq072


https://wolfram.com/xid/0puyldih26-i5m6v8

Wolfram Research (2007), EditDistance, Wolfram Language function, https://reference.wolfram.com/language/ref/EditDistance.html (updated 2020).
Text
Wolfram Research (2007), EditDistance, Wolfram Language function, https://reference.wolfram.com/language/ref/EditDistance.html (updated 2020).
Wolfram Research (2007), EditDistance, Wolfram Language function, https://reference.wolfram.com/language/ref/EditDistance.html (updated 2020).
CMS
Wolfram Language. 2007. "EditDistance." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/EditDistance.html.
Wolfram Language. 2007. "EditDistance." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/EditDistance.html.
APA
Wolfram Language. (2007). EditDistance. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EditDistance.html
Wolfram Language. (2007). EditDistance. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EditDistance.html
BibTeX
@misc{reference.wolfram_2025_editdistance, author="Wolfram Research", title="{EditDistance}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/EditDistance.html}", note=[Accessed: 20-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_editdistance, organization={Wolfram Research}, title={EditDistance}, year={2020}, url={https://reference.wolfram.com/language/ref/EditDistance.html}, note=[Accessed: 20-March-2025
]}