Skip to content
moxon home

Levenshtein Distance

The /levenshtein endpoint allows you to calculate the Levenshtein distance between two strings. This distance represents the minimum number of operations required to transform one string into another.

gethttps://api.moxon.dev/v5/levenshtein

How it works?

The Levenshtein distance counts the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one string into another. Useful for spell checking, fuzzy matching, DNA analysis, and plagiarism detection.

Try itget/v5/levenshtein

Parameters

  • str1stringrequired

    The first string (max 1000 characters)

  • str2stringrequired

    The second string (max 1000 characters)

Response Fields

  • str1string

    The first input string

  • str2string

    The second input string

  • distancenumber

    The Levenshtein distance between the two strings

Code Examples

Error Handling

If parameters are missing or invalid, the API will return an error:

  • 400Please provide a first string (?str1={string})The str1 parameter is missing
  • 400Please provide a second string (&str2={string})The str2 parameter is missing