HTML autocorrect Attribute

Beginner
6 min read
Updated: Nov 2026
3 examples
Live preview

Definition and Usage

The autocorrect global attribute tells supporting browsers whether to automatically correct spelling while the user edits text. Use on for natural-language fields and off for codes, names, or tokens that must stay exact.

It complements spellcheck (marking possible errors) and autocapitalize (capitalization hints). Autocorrect may change the typed characters; spellcheck usually only highlights them.

Progressive enhancement.

Platforms that lack autocorrection simply ignore the attribute. Always design so the field still works without it.

Hints, not guarantees.

Even with autocorrect="on", the OS keyboard settings can override or disable automatic corrections.

HTML Syntax

syntax.html
<element autocorrect ="on|off">

Works as a global attribute. Effects appear on editable text when the browser and OS support spelling autocorrection.

Attribute Values

Enumerated keywords:

ValueDescriptionTry it
onAllow automatic spelling corrections when supportedTry it
offDiscourage automatic corrections (best for codes and tokens)Try it

Live Preview

Flip autocorrect on a textarea. On mobile keyboards that support it, typing behavior changes; desktop may show little difference.

Best verified on a phone keyboard. Desktop browsers often leave the text unchanged.

Result

autocorrect="on"

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Enable Autocorrect on a Textarea

Natural-language notes benefit from automatic spelling fixes where the platform supports them.

HTML
<label for="note">Meeting notes</label>
<textarea id="note" name="note" rows="4" autocorrect="on"></textarea>
Try It Yourself

How It Works

  1. Set on. Allow the platform to correct spelling while typing.
  2. Pair with language. A correct lang on the page or field helps dictionaries.
  3. Still editable. Users can undo or override corrections.
  4. Mobile first. Expect the clearest effect on virtual keyboards.

Example 2 — Turn Off for Invite Codes

Codes and identifiers should not be rewritten by autocorrect.

HTML
<label for="code">Invite code</label>
<input id="code" name="code" type="text"
       autocorrect="off" spellcheck="false"
       autocomplete="off" placeholder="AB12-XY99">
Try It Yourself

How It Works

  1. Use off. Discourage automatic spelling changes.
  2. Disable spellcheck too. Reduces noisy underlines on token-like text.
  3. Turn autocomplete off when the value is unique and not a saved profile field.
  4. Protect accuracy. Wrong corrections break logins and redemptions.

Example 3 — contenteditable Region

Autocorrect applies to editable regions the same way as form fields when supported.

HTML
<div contenteditable="true" autocorrect="on"
     role="textbox" aria-multiline="true"
     aria-label="Editable note">
  Draft a sentense here.
</div>
Try It Yourself

How It Works

  1. Mark editable. contenteditable="true" makes the region accept typing.
  2. Add autocorrect. Supporting platforms may fix spelling as you type.
  3. Label accessibly. Use role and aria-label (or a visible label).
  4. Test on device. Desktop editors may not autocorrect even when the attribute is present.

Edge Cases & Pitfalls

Autocorrect is a soft hint — field type and OS settings still win.

vs spellcheck

Different jobs

spellcheck marks possible mistakes; autocorrect may rewrite them. Set both deliberately on sensitive fields.

mobile

Desktop may ignore it

Many desktop browsers never autocorrect. Do not rely on it for correctness — validate on the server.

privacy

Sensitive text

Prefer off for secrets, medical notes, or anything that should not leave the device via a cloud keyboard feature.

names

Proper nouns

Names and brand spellings often get “fixed” incorrectly — disable autocorrect on those inputs.

Browser Support

autocorrect is an HTML attribute for browsers. It is not a Node.js, Deno, or Bun API.

✓ Limited · Progressive enhancement

autocorrect

Best supported in Safari/WebKit; other engines are catching up. Always treat as optional.

70% Global support (approx.)
Google Chrome Modern (growing)
Full support
Mozilla Firefox Limited / none
Limited
Apple Safari Yes
Full support
Microsoft Edge Modern (growing)
Full support
Opera Modern
Full support
Samsung Internet Modern
Full support
Internet Explorer No support
Not supported
autocorrect Partial / growing

Bottom line: Safe to set for better mobile UX. Never depend on autocorrect for data quality.

Key Takeaways

  • Role: hint whether spelling may be auto-fixed while typing.
  • Values: on or off.
  • Codes: turn it off for tokens, usernames, and IDs.
  • Not spellcheck: autocorrect rewrites; spellcheck highlights.

One line: autocorrect asks the keyboard to fix spelling — or leave the text alone.

Frequently Asked Questions

It hints whether the browser or OS may automatically correct spelling as the user types in editable text. Typical values are on and off.
No. spellcheck controls whether spelling may be underlined or checked. autocorrect controls whether the browser may rewrite the text for you.
It is a global attribute, but the effect shows on editable content — text-like inputs, textarea, and contenteditable regions — when the platform supports autocorrection.
Often no or weakly. Effects are most noticeable on mobile virtual keyboards and platforms that already autocorrect.
Yes. Disable it for usernames, invite codes, API keys, and other fields where automatic spelling changes would corrupt the value.
Support is strongest in Safari/WebKit and growing elsewhere. Treat it as a progressive enhancement and pair with spellcheck when needed.

Next: autocomplete

Help browsers autofill forms with the right field hints.

autocomplete tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful