The HTML autocorrect attribute
The HTML autocorrect attribute controls whether the browser automatically corrects spelling and punctuation as the user types in editable fields. Values are on and off. It is a global attribute (originating in Safari and now standardized), so disable it for codes and identifiers.
Overview
The autocorrect attribute turns the browser's automatic text correction on or off for editable fields and contenteditable elements. It is distinct from spellcheck, which only flags possible mistakes rather than rewriting the text.
Disable it (autocorrect="off") for usernames, email addresses, URLs, codes and other content the browser should never silently change.
Values
| Value |
|---|
| on | off |
Example
<input type="text" autocorrect="off" spellcheck="false" placeholder="username (no autocorrect)" style="padding:8px; width:100%;">
Best practices
- Use inputmode to bring up the right on-screen keyboard (numeric, email, and so on).
- Set autocapitalize appropriately: off for names and codes, sentences for prose.
- These are hints; do not rely on them for validation.
- Test on real mobile devices, where most of these take effect.
Frequently asked questions
What does the autocorrect attribute do?
Is autocorrect guaranteed to work?
What is the difference between autocorrect and spellcheck?
autocorrect lets the browser rewrite text as the user types; spellcheck only flags possible mistakes and leaves the text alone.






















