Calculates the minimum number of single-character edits (insertions, deletions, substitutions) needed to transform one string into another. Access via MCP in Cursor or Windsurf, or REST at `/v1/text/levenshtein`. Returns precise integer distance — useful for fuzzy matching, spell checking, and similarity scoring in AI workflows.
curl "https://tinyfn.io/v1/text/levenshtein" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/text/levenshtein', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/text/levenshtein',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's text analysis tools:
{
"mcpServers": {
"tinyfn-text": {
"url": "https://tinyfn.io/mcp/text",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Levenshtein distance counts the minimum single-character edits (insert, delete, substitute) to transform string A into string B. 'cat' to 'bat' = 1 edit (substitute c→b), 'kitten' to 'sitting' = 3 edits.
Import the TinyFn MCP server in Cursor, Claude Code, or Windsurf, then call the levenshtein tool with two strings as parameters. Perfect for fuzzy search implementations or data deduplication workflows.
Levenshtein only allows single-character operations, while Damerau-Levenshtein adds transposition. Jaro-Winkler focuses on prefix matches. Levenshtein is stricter and better for exact similarity measurement.
Yes, it treats each Unicode code point as a single character. 'café' to 'cafe' = 1 edit (é→e). Emojis and accented characters are handled correctly as distinct characters.
The maximum distance equals the length of the longer string — when strings share no common characters, you need to delete all characters from one and insert all characters of the other.
Get your free API key and start using Levenshtein Distance in seconds.
Get Free API Key