How does autocorrect decide which word you meant?
Autocorrect decides which real word you meant when a typed word looks wrong. It lists real words that are only a letter or two away, then scores each one: how close its letters are, how common the word is and how well it fits the words around it. The highest score wins, and that is not always your word.
In one line: A program that spots a word that looks mistyped, lists real words close to it and swaps in the one that scores best.
Last reviewed: 25 October 2026 3 min read
What decision does it make?
When you type a word, autocorrect checks whether it looks like a mistake. If it does, it makes one choice: which real word did you most likely mean? Then it either swaps that word in or leaves yours alone.
| Decision | Possible answers |
|---|---|
| Which word did you mean? | Keep the word you typed, or swap in the best-scoring real word from a short list of close words. |
What does it look at?
- Letters. It counts how many letters you would need to add, remove or change to turn your typing into each real word.
- Common words. A word people write all the time is a more likely guess than a rare one.
- Nearby words. The words around the mistake help. After "a slice of", the word "cake" fits better than "lake".
How does it learn the rule?
- Collect lots of writing. The program is given a huge amount of ordinary text written by people.
- Count the words. It counts how often each word appears, and which words usually sit next to each other.
- List close words. When a typed word looks wrong, it finds real words that are only a few letter changes away.
- Score and pick. It gives each close word a score from the letters, how common it is and the nearby words, and picks the top one.
Where can it go wrong?
- It swaps a word you meant. A name, a new slang word or a word from another language is not in its counts, so it may get "fixed" into a common word.
- It misses a real mistake. If you type a real word by accident, such as "piece" for "peace", there is no misspelling to spot. Only the nearby words can give it away.
- The clues can disagree. Care only about common words and the wrong word can win. Try it below.
Try it
Toy example with made-up scores: someone typed "I ate a pice of cake." Move the sliders to change how much autocorrect cares about each clue, and watch which word it picks.
A toy example: four real words close to the typo "pice", each scored from 0 to 5 on three clues. The numbers are made up for practice.
| Item | Values | Score at starting weights |
|---|---|---|
| piece | Close letters (0 to 5): 4; Common word (0 to 5): 3; Fits the sentence (0 to 5): 5 | 26 |
| prize | Close letters (0 to 5): 4; Common word (0 to 5): 4; Fits the sentence (0 to 5): 1 | 15 |
| pick | Close letters (0 to 5): 4; Common word (0 to 5): 3; Fits the sentence (0 to 5): 0 | 11 |
| place | Close letters (0 to 5): 3; Common word (0 to 5): 4; Fits the sentence (0 to 5): 1 | 13 |
Check it
What does autocorrect decide?
Answer: Which real word you most likely meant. It picks the most likely real word from a short list of close words.
You typed "pice" in "a pice of cake". Which clue points most strongly to "piece"?
Answer: The words around it. "Prize" and "pick" are close too, but only "piece" fits "a ___ of cake".
Why might autocorrect change a friend's name?
Answer: The name is rare in the writing it counted. A rare word scores low on "common word", so a common word can beat it.
For older readers
Computer scientists call the letter count edit distance: the smallest number of letters you must insert, delete or replace to turn one word into another. It can be worked out with a method called dynamic programming. Choosing the intended word is often framed as a noisy channel model: combine how likely each word is (from a language model built on word counts) with how likely that word was to be mistyped as what you see. Using the surrounding words as context helps catch real-word errors, such as "piece" for "peace".
Questions
Your word scored lower than a more common word close to it. Names, slang and words from other languages are often rare in the writing it learned from.
They are close cousins. A spell checker marks a word that looks wrong. Autocorrect goes one step further and swaps in the word it scores highest.
Only sometimes. Both are real words, so nothing looks misspelled. It has to notice that the words around it fit the other word better.