The autocomplete attribute tells the browser whether it may autofill a control and, with tokens, what kind of data to suggest. Use it on text or numeric <input> controls, <textarea>, <select>, and on a <form> as a default for its fields.
The value is either on, off, or a space-separated list of autofill tokens (for example given-name or shipping postal-code). Valid tokens also help meet WCAG 2.2 Success Criterion 1.3.5 (Identify Input Purpose).
Baseline · Widely available.
Not deprecated and not experimental. Stable across modern browsers. Autofill UI still differs by browser and saved user data.
off is not a password lock.
Most browsers still offer password-manager fill on login fields. Prefer semantic tokens like username and current-password instead of fighting autofill.
Syntax
HTML Syntax
syntax.html
<element autocomplete="on | off | token-list">
If a field omits autocomplete, the browser uses the value from its owning <form> (via nesting or the form attribute).
Values
Attribute Values
Start with these common values. Tokens can be combined with optional shipping / billing or a section-* group name.
Value
Description
Try it
off
Do not autofill (browsers may still ignore this on login fields)
shipping groups these fields as the delivery address (use billing for payment address).
Detail tokens name the piece: street, city (address-level2), postal code.
Space-separated list keeps the full meaning unique vs a billing twin of the same detail token.
Need two shipping addresses? Prefix with section-home / section-work so groups stay unique.
Edge Cases & Pitfalls
Most issues come from blocking autofill or using non-standard values.
login
off often fails on login
Password managers may still fill username/password. Use proper tokens; reserve off for cases like CAPTCHA where autofill truly hurts.
a11y
Fake tokens break purpose
Made-up strings stop helpful autofill and fail WCAG 1.3.5. Prefer real tokens or a justified off.
setup
Form + name/id + submit
Many user agents expect a name and/or id, a form ancestor, and a submit control before offering suggestions.
hidden
Hidden inputs cannot use on/off
On type="hidden", autocomplete must be a token list — not the keywords on or off.
firefox
Firefox persists some form state
Unlike other browsers, Firefox may restore disabled/checked state across loads unless you set autocomplete="off" (even on types where autofill otherwise seems irrelevant).
Compatibility
Browser Support
autocomplete is an HTML attribute for form controls in the browser. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
autocomplete
Widely supported across modern desktop and mobile browsers. Which suggestions appear depends on saved profiles, password managers, and each browser’s autofill UI.
97%Global support (approx.)
Google ChromeModern · Full
Full support
Mozilla FirefoxModern · Full
Full support
Apple SafariModern · Full
Full support
Microsoft Edge79+
Full support
OperaModern · Full
Full support
Samsung InternetModern · Full
Full support
Internet ExplorerPartial / older behavior
Partial
autocompleteWidely supported
Bottom line: Safe to use everywhere for UX and accessibility. Expect autofill UI and password-manager behavior to vary — test on your target browsers.
Remember
Key Takeaways
Role: allow or guide autofill with on, off, or purpose tokens.
Prefer tokens:email, given-name, current-password, and friends beat bare on.
Groups:shipping / billing and section-* keep address sets unique.
Don’t overuse off: it harms accessibility and often fails on login forms.
One line: name the field’s purpose with standard tokens — let the browser help users fill it.
Frequently Asked Questions
It tells the browser whether it may autofill a field and, with tokens like email or given-name, what kind of data to suggest.
It works on text or numeric input types, textarea, select, and form. If a field omits it, the owning form’s autocomplete value is used.
Usually not on login fields. Most browsers still offer to save or fill usernames and passwords. Prefer username and current-password tokens for login forms.
Tokens identify the field’s purpose (WCAG 1.3.5). That helps browsers, password managers, and assistive tech offer the right stored data.
They group address or contact tokens. Example: shipping postal-code vs billing postal-code so the browser can fill two different addresses.
Browsers often need a name or id, a form ancestor, and a submit control. Suggestions come from saved user data and may vary by browser.