References

Beginner-friendly references for web development, with live, editable examples.

The HTML autocorrect attribute

Global attribute Works on every element
In short

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

Live example
<input type="text" autocorrect="off" spellcheck="false" placeholder="username (no autocorrect)" style="padding:8px; width:100%;">

Best practices

  • Write off to disable autocorrect; false, no and an empty value are all read as on.
  • Skip the attribute on email, url and password inputs, where autocorrection stays off even with autocorrect="on". Use it on text, search and tel fields that hold codes or IDs.
  • Autocorrection can change punctuation as well as words, and on macOS a browser might apply the user's registered text replacements. In a markup or snippet editor, set autocorrect="off".
  • For an input or textarea, element.autocorrect returns a boolean that already folds in the form's setting and the input type. Assigning true or false writes on or off.
  • Safari 14.1 and Firefox 136 support it, but Chrome and Edge didn't add it until version 153. Test for "autocorrect" in HTMLElement.prototype before you read the property.

Frequently asked questions

What does the autocorrect attribute do?
Controls whether the browser automatically corrects spelling and punctuation as the user types.
Is autocorrect guaranteed to work?
No. It is a hint; whether text is actually corrected depends on the browser and on the platform's own autocorrection feature.
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.
Is autocorrect on when the attribute is missing?
Yes, a missing autocorrect counts as on, unless the field's form sets it to off. Email, url and password inputs are the exception, since the standard keeps them off.