References

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

The HTML autocorrect attribute

Global attribute Works on every element Updated
Quick answer

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

  • 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?
Controls whether the browser automatically corrects spelling and punctuation as the user types.
Are these attributes guaranteed to work?
No. They are hints that browsers and on-screen keyboards may honor or ignore, especially on desktop.
Which elements do they apply to?
They are global attributes, but they mainly affect editable and form fields.
Is autocorrect a global attribute?
Yes — it is a global attribute, so it can be set on any HTML element (it is a global attribute), most usefully on editable and form fields.