What Is Autocorrect and How Does It Work?

Autocorrect is software that detects likely typing errors and replaces them with the intended word in real time. It works by comparing each word you type against a dictionary, then using a language model to evaluate whether a substitution makes sense in context. When confidence crosses a threshold, the correction happens automatically, without any action from the writer.

How does autocorrect work on Mac?

macOS autocorrect is built on Apple's NSSpellChecker framework, which has been part of the operating system since Mac OS X 10.3. The framework uses two mechanisms in combination: a static dictionary lookup and a short-context language model.

When you type a word, NSSpellChecker checks it against its vocabulary. If the word is absent and a close match exists within a small edit distance (typically 1-2 character substitutions, transpositions, or deletions), the system considers a correction. It then consults a basic n-gram language model to check whether that correction fits the words immediately before and after it in the sentence.

The vocabulary at the core of this system covers approximately 10,000 of the most common English words. That is sufficient for everyday prose but leaves significant gaps for technical terminology, proper nouns, and less common vocabulary. When a word is not in the dictionary, NSSpellChecker cannot distinguish between a genuine misspelling and a legitimate but unusual word.

There is also an important architectural constraint: NSSpellChecker only functions in apps that explicitly opt in to it. Native macOS apps like Notes, Mail, and Pages do so by default. But many modern applications, especially Electron-based apps like Slack, Discord, and VS Code, bypass NSSpellChecker entirely and handle text input independently. This means macOS autocorrect is simply absent for a large portion of the apps a typical knowledge worker uses.

What are the different types of autocorrect?

Autocorrect systems fall into three broad categories, each with different capabilities and trade-offs.

Dictionary-based systems are the simplest. They maintain a list of known words and flag anything that does not appear on the list. A correction is made by finding the closest match in the dictionary using an edit-distance algorithm (typically Levenshtein distance). These systems are fast and require no training data, but they cannot use context, so they frequently misfire on words that are spelled correctly but used incorrectly.

N-gram language models extend the dictionary approach by adding probabilistic context. An n-gram model estimates the probability of a word given the preceding n-1 words. A bigram model looks at the word immediately before; a trigram model looks two words back. Studies show that trigram models reduce false correction rates by roughly 30% compared to dictionary-only systems. macOS uses a short n-gram window, which is why it struggles with longer sentences where context from several words back is relevant.

Transformer-based models represent the state of the art. These models, derived from architectures like BERT and GPT, process the full sentence context rather than a fixed window of two or three words. They produce dramatically better suggestions on ambiguous inputs, particularly for homophones and words that differ by a single character ("form" vs "from"). The trade-off is computational cost: running a full transformer on every keystroke requires either a fast GPU or a carefully compressed on-device model.

Finite state transducers (FSTs) are a fourth technique used to efficiently index large dictionaries and generate correction candidates. FSTs represent all possible edit-distance variations of a word as a graph, allowing fast lookup. They are commonly used as the candidate-generation layer before a language model re-ranks the results.

Why does autocorrect sometimes get it wrong?

Autocorrect errors generally fall into three categories: vocabulary gaps, context failures, and over-confidence.

Vocabulary gaps occur when a correctly spelled word is not in the dictionary. Names, technical terms, brand names, and neologisms all fall into this category. macOS autocorrect's 10,000-word vocabulary means it treats many legitimate words as misspellings. A system trained on a broader corpus, including technical writing and proper nouns, would reduce this class of error significantly.

Context failures happen when the language model does not have enough surrounding text to resolve ambiguity. "Duck" and "dock", "their" and "there", "form" and "from" - all are real words close to other real words. A bigram model looking only one word back cannot always tell which is intended. Research from Microsoft (2015) found that roughly 14% of autocorrect corrections on desktop keyboards are unwanted, with context failures accounting for the majority.

Over-confidence is a design choice. Systems calibrated to correct aggressively will catch more genuine errors but also make more mistakes on unusual but valid inputs. Systems calibrated conservatively avoid false corrections but miss more typos. The sweet spot depends on the user's writing patterns, which is why personalisation and broader vocabulary matter.

How does Charm improve on built-in autocorrect?

Charm's Spells feature replaces macOS autocorrect with a machine learning model trained on a much larger corpus. Where NSSpellChecker covers roughly 10,000 words, Charm's model covers 100,000+ words, including technical vocabulary, common proper nouns, and modern informal language.

The model uses a broader context window than NSSpellChecker's n-gram approach, pulling in more of the surrounding sentence to evaluate whether a correction makes sense. This reduces false positives on valid but uncommon words, and catches errors that a bigram model would miss because the disambiguating context sits further back in the sentence.

Charm also solves the coverage problem. Because it operates via the macOS Accessibility API rather than NSSpellChecker, it works in every text field on the system - including Slack, VS Code, Discord, and any other Electron app where built-in macOS autocorrect is simply absent. Research suggests that the average Mac user now spends over 40% of their typing time in Electron-based applications, meaning built-in autocorrect is inactive for nearly half of all keystrokes on a typical Mac.

When Charm makes a correction, the affected text briefly highlights with a cyan glow - visible feedback that a change was made, so you can review and revert instantly if needed. The entire process runs on-device, with no text transmitted to external servers.

Key fact: Studies show that 94% of autocorrect corrections accepted by users are genuinely correct. The challenge is minimising the 6% of false corrections, which cause the friction and frustration most people associate with autocorrect. A larger vocabulary and deeper context window are the two most effective ways to reduce that error rate.

Frequently asked questions

What is autocorrect?

Autocorrect is software that detects likely typing errors and replaces them with the intended word, automatically or on suggestion. It compares typed words to a dictionary, then uses a language model to check whether the correction fits the surrounding context.

How does macOS autocorrect work?

macOS autocorrect uses Apple's NSSpellChecker framework, which combines dictionary lookup with a short-context n-gram language model. It covers roughly 10,000 common words and only works in apps that opt in to the framework - which excludes many modern Electron-based apps.

Why does autocorrect change correct words?

Autocorrect changes correct words when the language model assigns higher probability to a different word given the nearby context. Short context windows and limited vocabulary cause the system to misread intent - especially for technical terms, names, or words that closely resemble common typos.

What is the difference between autocorrect and grammar check?

Autocorrect targets individual word-level errors: typos, misspellings, transposed characters. Grammar check operates at the sentence level, catching issues like subject-verb disagreement, tense errors, and punctuation mistakes. The two use different models and target different kinds of error.

Does autocorrect learn over time?

macOS autocorrect adds words you repeatedly type to your personal word list, but does not update its underlying language model. Charm stores accepted corrections locally to improve future suggestions, with no data sent to any server.

Autocorrect that actually knows your vocabulary.

Charm covers 100,000+ words, works in every Mac app, and costs $9.99 once - yours forever.

Learn more about Charm Get Charm for Mac $9.99