# Python fuzzy search libraries

Python fuzzy search libraries find strings that nearly match a query despite typos, reordered words, or different spellings. A scorer computes an edit distance or similarity ratio between two strings and ranks candidates by that score. These libraries let apps and AI agents match names and records that differ by a few characters.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [regex](#regex) | 391.9M | Not on GitHub | Nov 2026 | Apache-2.0 AND CNRI-Python |
| [RapidFuzz](#rapidfuzz) | 143.8M | 4.2K | Aug 2026 | MIT |
| [Levenshtein](#levenshtein) | 20.5M | Not on GitHub | Sep 2026 | GPL-2.0-or-later |
| [jellyfish](#jellyfish) | 11.1M | 2.2K | Oct 2026 | MIT |
| [TheFuzz](#thefuzz) | 9.9M | 3.6K | Jan 2024 | MIT |
| [Polyleven](#polyleven) | 5.4M | Not on GitHub | Oct 2026 | MIT |
| [pyspellchecker](#pyspellchecker) | 3.5M | Not on GitHub | Oct 2026 | MIT |
| [editdistance](#editdistance) | 2.7M | Not on GitHub | Feb 2024 | MIT |

Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[RapidFuzz](#rapidfuzz) has the most monthly downloads among the dedicated fuzzy matching libraries in this comparison, at 143.8M.

## Capabilities

| Library | Ranks arbitrary choices | Fuzzy substring offsets | Phonetic encodings |
| --- | --- | --- | --- |
| [regex](#regex) | No | Yes | No |
| [RapidFuzz](#rapidfuzz) | Yes | Yes | No |
| [Levenshtein](#levenshtein) | No | No | No |
| [jellyfish](#jellyfish) | No | No | Yes |
| [TheFuzz](#thefuzz) | Yes | No | No |
| [Polyleven](#polyleven) | No | No | No |
| [pyspellchecker](#pyspellchecker) | No | No | No |
| [editdistance](#editdistance) | No | No | No |

## Libraries

### regex

[GitHub](https://github.com/mrabarnett/mrab-regex) · [PyPI](https://pypi.org/project/regex) · [Docs](https://api.github.com/repos/mrabarnett/mrab-regex/contents/README.rst)

Matches regular expressions approximately, with limits on insertions, deletions, and substitutions.

- Downloads / mo: 391.9M
- Last release: 2026.11.19
- License: Apache-2.0 AND CNRI-Python
- Capabilities: [From the regex docs](https://api.github.com/repos/mrabarnett/mrab-regex/contents/README.rst)

```sh
python3.13 -m pip install regex==2026.11.19
```

**gandersen101/spaczz** (260 stars)

[gandersen101/spaczz](https://github.com/gandersen101/spaczz) 

```python
@staticmethod
def _spans_from_regex(
    doc: Doc,
    match: Match[str],
    partial: bool,
    char_to_token_map: ty.Dict[int, int],
) -> ty.Optional[ty.Tuple[Span, ty.Tuple[int, int, int]]]:
    """Creates `Span` objects from regex matches."""
    start, end = match.span()
    counts = getattr(match, "fuzzy_counts", (0, 0, 0))
    span = doc.char_span(start, end)
    if span:
        return (span, counts)
    if partial:
        start_token = char_to_token_map.get(start)
        end_token = char_to_token_map.get(end - 1)
        if start_token is not None and end_token is not None:
            span = Span(doc, start_token, end_token + 1)
            return (span, counts)
    return None
```

[src/spaczz/_search/regexsearcher.py](https://github.com/gandersen101/spaczz/blob/0b774b68e2495008a9579700194bb88789a1af45/src/spaczz/_search/regexsearcher.py) · [More projects using regex →](https://dashboard.exa.ai/playground/search?q=regex%20GitHub%20projects)

**Quickstart**

```python
import regex

regex.fullmatch(r"(?:cats|cat){e<=1}", "cat").fuzzy_counts
```

From [README.rst](https://api.github.com/repos/mrabarnett/mrab-regex/contents/README.rst)

### RapidFuzz

[GitHub](https://github.com/rapidfuzz/RapidFuzz) · [PyPI](https://pypi.org/project/rapidfuzz) · [Docs](https://pypi.org/pypi/rapidfuzz/3.14.6/json)

Provides string similarity metrics and candidate matching APIs.

- Downloads / mo: 143.8M
- Stars: 4.2K
- Last release: 3.14.6
- License: MIT
- Capabilities: [From the RapidFuzz docs](https://pypi.org/pypi/rapidfuzz/3.14.6/json)

**Strengths**

- **Ranks matching choices.** Use process.extract or extractOne to search a collection of candidates.
- **Handles reordered word tokens.** Use token_sort_ratio when word order should not determine the match.

**Watch out for**

- **Preprocessing is opt-in.** Supply a processor when case and punctuation should be normalized.
- **Token sets ignore extra words.** Token-set scoring can treat a token subset as a complete match.

```sh
python3.13 -m pip install rapidfuzz==3.14.6
```

**paperless-ngx/paperless-ngx** (48.2K stars)

[paperless-ngx/paperless-ngx](https://github.com/paperless-ngx/paperless-ngx) 

```python
def _process_and_match(work: _WorkPackage) -> _WorkResult:
    """
    Process document content and compute the fuzzy ratio.
    score_cutoff lets rapidfuzz short-circuit when the score cannot reach the threshold.
    """
    first_string = rapidfuzz.utils.default_process(work.content_a)
    second_string = rapidfuzz.utils.default_process(work.content_b)
    ratio = rapidfuzz.fuzz.ratio(
        first_string,
        second_string,
        score_cutoff=work.score_cutoff,
    )
    return _WorkResult(work.pk_a, work.pk_b, ratio)
```

[src/documents/management/commands/document_fuzzy_match.py](https://github.com/paperless-ngx/paperless-ngx/blob/14252054a150595d89040a02cb510b9f43f4570b/src/documents/management/commands/document_fuzzy_match.py) · [More projects using RapidFuzz →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20rapidfuzz%20for%20approximate%20string%20matching%2C%20candidate%20ranking%2C%20duplicate%20detection%2C%20spelling%20comparison%20and%20phonetic%20scoring&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
from rapidfuzz import fuzz

fuzz.ratio("this is a test", "this is a test!")
```

From [README.md](https://pypi.org/pypi/rapidfuzz/3.14.6/json)

### Levenshtein

[GitHub](https://github.com/rapidfuzz/Levenshtein) · [PyPI](https://pypi.org/project/Levenshtein) · [Docs](https://rapidfuzz.github.io/Levenshtein/levenshtein.html)

Computes edit distances, similarity ratios, and edit operations between strings.

- Downloads / mo: 20.5M
- Last release: 0.27.5
- License: GPL-2.0-or-later
- Capabilities: [From the Levenshtein docs](https://rapidfuzz.github.io/Levenshtein/levenshtein.html)

```sh
python3.13 -m pip install Levenshtein==0.27.5
```

**EuroEval/EuroEval** (205 stars)

[EuroEval/EuroEval](https://github.com/EuroEval/EuroEval) 

```python
def get_closest_match(
    string: str,
    options: c.Iterable[str],
    case_sensitive: bool,
    insertion_weight: int = 1,
    deletion_weight: int = 1,
    substitution_weight: int = 1,
) -> tuple[str, int]:
    """Find the closest match to a given string.

    Args:
        string:
            The string to match.
        options:
            The options to match against.
        case_sensitive:
            Whether to match case sensitively.
        insertion_weight (optional):
            The weight of insertions in the Levenshtein distance. Defaults to 1.
        deletion_weight (optional):
            The weight of deletions in the Levenshtein distance. Defaults to 1.
        substitution_weight (optional):
            The weight of substitutions in the Levenshtein distance. Defaults to 1.

    Returns:
        A pair (closest_match, distance) where closest_match is the closest match to the
        given string and distance is the Levenshtein distance between the two.
    """
    distances = {
        option: distance(
            s1=string.lower() if not case_sensitive else string,
            s2=option.lower() if not case_sensitive else option,
            weights=(insertion_weight, deletion_weight, substitution_weight),
        )
        for option in options
    }
    closest_match = min(distances, key=lambda k: distances[k])
    return closest_match, distances[closest_match]
```

[src/euroeval/closest_match.py](https://github.com/EuroEval/EuroEval/blob/efb93af3a364dd58e166fb1cb45aa44fb3234297/src/euroeval/closest_match.py) · [More projects using Levenshtein →](https://dashboard.exa.ai/playground/search?q=Levenshtein%20GitHub%20projects)

**Quickstart**

```python
from Levenshtein import distance

distance("lewenstein", "levenshtein")
```

From [levenshtein.html](https://rapidfuzz.github.io/Levenshtein/levenshtein.html)

### jellyfish

[GitHub](https://github.com/jamesturk/jellyfish) · [PyPI](https://pypi.org/project/jellyfish) · [Docs](https://jpt.sh/projects/jellyfish/functions/)

Provides approximate string comparison and phonetic encoding functions.

- Downloads / mo: 11.1M
- Stars: 2.2K
- Last release: 1.3.0
- License: MIT
- Capabilities: [From the jellyfish docs](https://jpt.sh/projects/jellyfish/functions/)

**Strengths**

- **Compares spelling and pronunciation.** Choose string-comparison functions or phonetic encoders for the matching task.
- **Compares sets of words.** Jaccard similarity can compare words or configured character sequences.

**Watch out for**

- **NYSIIS targets English names.** Choose another approach when the relevant pronunciation follows another language.

```sh
python3.13 -m pip install jellyfish==1.3.0
```

**J535D165/recordlinkage** (1.1K stars)

[J535D165/recordlinkage](https://github.com/J535D165/recordlinkage) 

```python
def jarowinkler_similarity(s1, s2):
    conc = pandas.Series(list(zip(s1, s2)))

    from jellyfish import jaro_winkler_similarity

    def jaro_winkler_apply(x):
        try:
            return jaro_winkler_similarity(x[0], x[1])
        except Exception as err:
            if pandas.isnull(x[0]) or pandas.isnull(x[1]):
                return np.nan
            else:
                raise err

    return conc.apply(jaro_winkler_apply)
```

[recordlinkage/algorithms/string.py](https://github.com/J535D165/recordlinkage/blob/91bd75a7848627fb3c67c02303927612db7d9ac5/recordlinkage/algorithms/string.py) · [More projects using jellyfish →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20jellyfish%20for%20approximate%20string%20matching%2C%20candidate%20ranking%2C%20duplicate%20detection%2C%20spelling%20comparison%20and%20phonetic%20scoring&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import jellyfish

jellyfish.levenshtein_distance("jellyfish", "smellyfish")
```

From [README.md](https://jpt.sh/projects/jellyfish/functions/)

### TheFuzz

[GitHub](https://github.com/seatgeek/thefuzz) · [PyPI](https://pypi.org/project/thefuzz) · [Docs](https://pypi.org/pypi/thefuzz/0.22.1/json)

Provides fuzzy string scoring and matching against candidate collections.

- Downloads / mo: 9.9M
- Stars: 3.6K
- Last release: 0.22.1
- License: MIT
- Capabilities: [From the TheFuzz docs](https://pypi.org/pypi/thefuzz/0.22.1/json)

**Strengths**

- **Ranks choices with custom scorers.** Pass a scorer to extractOne to change how candidates are matched.
- **Handles reordered word tokens.** Use token_sort_ratio when comparing text with reordered words.

**Watch out for**

- **Rounds similarity scores.** Standard scorer results are rounded to integers.
- **Deduplication favors longer text.** dedupe retains the longest matching string, with alphabetical tie-breaking.

```sh
python3.13 -m pip install thefuzz==0.22.1
```

**apastel/ytmusic-deleter** (278 stars)

[apastel/ytmusic-deleter](https://github.com/apastel/ytmusic-deleter) 

```python
def _partial_match(titleA, titleB, score_cutoff):
    score = fuzz.partial_ratio(titleA, titleB)

    # Make sure this result at least passes the score cutoff
    is_match = score >= score_cutoff
    if is_match:
        logging.debug(
            f"""
            Token A: {titleA}
            Token B: {titleB}
            Score: {score} ✅
        """
        )
        return is_match
```

[ytmusic_deleter/duplicates.py](https://github.com/apastel/ytmusic-deleter/blob/a4660fb0bedd4f40335097df44794cfca6a46d26/ytmusic_deleter/duplicates.py) · [More projects using TheFuzz →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20thefuzz%20for%20approximate%20string%20matching%2C%20candidate%20ranking%2C%20duplicate%20detection%2C%20spelling%20comparison%20and%20phonetic%20scoring&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
from thefuzz import fuzz

fuzz.ratio("this is a test", "this is a test!")
```

From [README.rst](https://pypi.org/pypi/thefuzz/0.22.1/json)

### Polyleven

[GitHub](https://github.com/fujimotos/polyleven) · [PyPI](https://pypi.org/project/polyleven) · [Docs](https://api.github.com/repos/fujimotos/polyleven/contents/README.rst)

Computes Levenshtein distance between Unicode strings with an optional maximum distance.

- Downloads / mo: 5.4M
- Last release: 0.12.0
- License: MIT
- Capabilities: [From the Polyleven docs](https://api.github.com/repos/fujimotos/polyleven/contents/README.rst)

```sh
python3.13 -m pip install polyleven==0.12.0
```

**rotki/rotki** (4.1K stars)

[rotki/rotki](https://github.com/rotki/rotki) 

```python
def _search_only_nfts_levenstein(
        cursor: DBCursor,
        filter_query: LevenshteinFilterQuery,
) -> list[tuple[int, dict[str, Any]]]:
    query, bindings = filter_query.prepare('nfts')
    cursor.execute('SELECT identifier, name, collection_name FROM nfts ' + query, bindings)
    search_result: list[tuple[int, dict[str, Any]]] = []
    for entry in cursor:
        lev_dist_min = 100
        if entry[1] is not None:
            lev_dist_min = min(
                lev_dist_min,
                levenshtein(filter_query.substring_search, entry[1].casefold()),
            )
        if entry[2] is not None:
            lev_dist_min = min(
                lev_dist_min,
                levenshtein(filter_query.substring_search, entry[2].casefold()),
            )
        entry_info = {
            'identifier': entry[0],
            'name': entry[1],
            'collection_name': entry[2],
            'asset_type': AssetType.NFT.serialize(),
        }
        search_result.append((lev_dist_min, entry_info))

    return search_result
```

[rotkehlchen/db/search_assets.py](https://github.com/rotki/rotki/blob/dc0251e875d7707f84b0778f74d29256b043a33f/rotkehlchen/db/search_assets.py) · [More projects using Polyleven →](https://dashboard.exa.ai/playground/search?q=polyleven%20GitHub%20projects)

**Quickstart**

```python
from polyleven import levenshtein

levenshtein("aaa", "ccc")
```

From [README.rst](https://api.github.com/repos/fujimotos/polyleven/contents/README.rst)

### pyspellchecker

[GitHub](https://github.com/barrust/pyspellchecker) · [PyPI](https://pypi.org/project/pyspellchecker) · [Docs](https://api.github.com/repos/barrust/pyspellchecker/contents/docs/source/quickstart.rst)

Corrects spelling from word-frequency dictionaries with a configurable edit distance.

- Downloads / mo: 3.5M
- Last release: 0.9.1
- License: MIT
- Capabilities: [From the pyspellchecker docs](https://api.github.com/repos/barrust/pyspellchecker/contents/docs/source/quickstart.rst)

```sh
python3.13 -m pip install pyspellchecker==0.9.1
```

**sql-machine-learning/sqlflow** (5.2K stars)

[sql-machine-learning/sqlflow](https://github.com/sql-machine-learning/sqlflow) 

```python
def spell_check():
    spell = SpellChecker()
    spell.word_frequency.load_words(known)
    num = 0
    for line in sys.stdin.readlines():
        num += 1
        words = list(
            filter(
                lambda w: w.lower() not in known and w[0] not in "'0123456789"
                and len(w) > 4 and all(ord(c) < 128 for c in w),
                re.findall(r"[\w']+", line)))
        known.update(map(lambda w: w.lower(), words))
        print('#', num, end='\r')
        time.sleep(0.002)
        for identifier in words:
            misspelled = spell.unknown(
                re.split(r"(?<=[a-z0-9])(?=[A-Z])|_|(?<=[A-Z])(?=[A-Z][a-z])",
                         identifier))
            # Get the one `most likely` answer
            for word in misspelled:
                print('#', num, identifier, '\t',
                      "s/%s/%s" % (word, spell.correction(word)))
```

[python/tools/spell_check.py](https://github.com/sql-machine-learning/sqlflow/blob/6c492098320875427b08ad82ce3f874c0b6aaa7a/python/tools/spell_check.py) · [More projects using pyspellchecker →](https://dashboard.exa.ai/playground/search?q=pyspellchecker%20GitHub%20projects)

**Quickstart**

```python
from spellchecker import SpellChecker

spell = SpellChecker()
spell.known(["morning", "hapenning"])
```

From [quickstart.rst](https://api.github.com/repos/barrust/pyspellchecker/contents/docs/source/quickstart.rst)

### editdistance

[GitHub](https://github.com/roy-ht/editdistance) · [PyPI](https://pypi.org/project/editdistance) · [Docs](https://api.github.com/repos/roy-ht/editdistance/contents/README.md)

Computes Levenshtein distance on strings or sequences of hashable items in C++.

- Downloads / mo: 2.7M
- Last release: 0.8.1
- License: MIT
- Capabilities: [From the editdistance docs](https://api.github.com/repos/roy-ht/editdistance/contents/README.md)

```sh
python3.13 -m pip install editdistance==0.8.1
```

**PaddlePaddle/PaddleSpeech** (12.7K stars)

[PaddlePaddle/PaddleSpeech](https://github.com/PaddlePaddle/PaddleSpeech) 

```python
def calculate_cer(self, seqs_hat, seqs_true):
    """Calculate sentence-level CER score.

    :param list seqs_hat: prediction
    :param list seqs_true: reference
    :return: average sentence-level CER score
    :rtype float
    """
    char_eds, char_ref_lens = [], []
    for i, seq_hat_text in enumerate(seqs_hat):
        seq_true_text = seqs_true[i]
        hyp_chars = seq_hat_text.replace(" ", "")
        ref_chars = seq_true_text.replace(" ", "")
        char_eds.append(editdistance.eval(hyp_chars, ref_chars))
        char_ref_lens.append(len(ref_chars))
    return float(sum(char_eds)) / sum(char_ref_lens)
```

[paddlespeech/s2t/utils/error_rate.py](https://github.com/PaddlePaddle/PaddleSpeech/blob/6b25a400008d393f9c3af837b3c692b17f29ee1a/paddlespeech/s2t/utils/error_rate.py) · [More projects using editdistance →](https://dashboard.exa.ai/playground/search?q=editdistance%20GitHub%20projects)

**Quickstart**

```python
import editdistance
editdistance.eval('banana', 'bahama')
```

From [README.md](https://api.github.com/repos/roy-ht/editdistance/contents/README.md)

## FAQ

### Which Python fuzzy search library should I use?

[RapidFuzz](#rapidfuzz) suits most fuzzy matching, with string scorers and ranked extraction from a list of candidates. [jellyfish](#jellyfish) suits phonetic matching such as Soundex and Metaphone. [regex](#regex) suits approximate matching inside a regular expression.

### What is RapidFuzz?

[RapidFuzz](#rapidfuzz) provides string similarity metrics and ranks a list of candidates against a query. A separate alignment API returns where the match falls in each string.

### What happened to FuzzyWuzzy?

[TheFuzz](#thefuzz) carries FuzzyWuzzy-style string, token, and partial scores under a new package name. It is implemented on RapidFuzz.

### How do I compute Levenshtein distance in Python?

[Levenshtein](#levenshtein) computes edit distance, normalized ratios, and edit operations between two strings. [editdistance](#editdistance) and [Polyleven](#polyleven) compute the distance alone, and Polyleven accepts a maximum distance.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best Python fuzzy search libraries RapidFuzz TheFuzz TextDistance jellyfish examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
