> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Typo tolerance

> How Algolia handles typing mistakes and spelling errors.

export const Records = () => <Tooltip tip="A record is a searchable object in an Algolia index. Each record consists of named attributes." cta="Algolia records" href="/doc/guides/sending-and-managing-data/prepare-your-data#algolia-records">
    records
  </Tooltip>;

export const Index = () => <Tooltip tip="An Algolia index is a searchable dataset that consists of records and configuration settings. These settings define how the records are searched and ranked.">
    index
  </Tooltip>;

A typo is a typing mistake or spelling error, such as:

* Missing letters: "hllo" → "hello"
* Extra letters: "heello" → "hello"
* Swapped letters: "hlelo" → "hello"
* Substituted letters: "heilo" → "hello"

## What's typo tolerance?

Typo tolerance lets users make mistakes while typing but still find the <Records /> they're looking for.
This is done by matching words that are close in spelling.

Tolerating typos is fundamental to modern search experiences for two reasons:

* Typos are inevitable on mobile devices.
* Because products and services are growing in both complexity and global reach, not everyone knows the right way to spell a word.

Algolia provides typo tolerance out-of-the-box, along with some important ways to customize just how tolerant a search experience should be.

<Info>
  By default, Algolia matches query terms at the **beginning of words** in your records (prefix matching). For alternatives, see [Match queries in the middle or end of words](/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/how-to/how-can-i-make-queries-within-the-middle-of-a-word).
</Info>

## How typos are calculated

Algolia's algorithm for dealing with typos is based on **the difference in spelling between a query word and its exact match in the <Index />: the distance.**

### Calculating distance

Distance is the count of operations (additions, deletions, substitutions, or transpositions) needed to change one word into another.

For example, the query "strm" might mean "storm" or "strum" (distance=1),
"star" or "warm" (distance=2).
The following examples illustrate the calculated distances between various search queries and the target word "Michael".

* **michael** = 0. Algolia isn't case-sensitive ("michael" = "Michael")
* **mickael** = 1 (substitution: h → k)
* **micael** = 1 (deletion: h)
* **mickhael** = 1 (addition: k)
* **micheal** = 1 (transposition: a ⇄ e)
* **mickaell** = 2 (substitution: h → k, addition: l)
* **Tichael** = 2 (substitution: m → T, first letter)
* **Tickael** = 3 (substitution: m → T, first letter, substitution h → k).

Algolia handles up to two typos in a word.
An exception is made for [words with three typos](/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance#three-typos) but only if the first typo occurs on the initial letter.
The final item in the preceding example ("Tickael") illustrates this.

Typo tolerance is ignored for:

* Logogram-based languages, such as Chinese and Japanese, use pictures to represent words (or partial words). Typo tolerance only applies to phonemic languages (such as English, French, and Russian), where characters represent sounds to form words.
* Punctuation and special characters
* [Splits and concatenations](/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/splitting-and-concatenation) (insertion or removal of spaces between two words)
* Any user query between quotes (if you've enabled [`advancedSyntax`](/doc/api-reference/api-parameters/advancedSyntax)).

## Impact of typos on the ranking formula

Typo count is the first criterion in [Algolia's ranking formula](/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria).
This means that words with perfect matches (no typos) rank higher than words with one typo, and one-typo words rank higher than words with two typos.
There's also a [special ranking rule](/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance#typos-on-the-first-letter) if there's a typo on the first letter.

## Configure typo tolerance settings

Enabling typo tolerance is often enough but certain queries or datasets require fine-tuning the settings.
For more information, see [Configuring typo tolerance](/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance).

## See also

To learn more, see these blog articles:

* [Fuzzy search using typo tolerance](https://www.algolia.com/blog/engineering/discover-what-fuzzy-search-is-with-fuzzy-matching/)
* [Mobile typos](https://www.algolia.com/blog/ux/mobile-search-ux-best-practices/)
