How to Disable Browser Autocomplete on Form Inputs
In this article
To disable browser autocomplete on a web form field, add the attribute autocomplete="off" to the <input> tag (or to the parent <form>). For most modern browsers, that single attribute stops the dropdown of previously typed values. For password fields, use autocomplete="new-password" or autocomplete="current-password" instead of off, because browsers often ignore off on passwords. If you need to stop the browser from offering to save the whole form, add autocomplete="off" to the <form> element as well. The exact behaviour varies by browser and version, so test in the browsers your users actually use.
What You'll Need
- Access to the HTML source of the form (a code editor or CMS template editor).
- A browser to test the change (Chrome, Firefox, Safari, Edge).
- Basic familiarity with HTML attributes.
Step-by-Step
- Open the form's HTML file or template. Locate the
<form>tag and the<input>tags inside it. If you use a CMS, find the template or block that renders the form. - Add
autocomplete="off"to the form element. This tells the browser not to remember values for the whole form. Example:<form autocomplete="off">. Some browsers still autofill individual fields, so you may also need the next step. - Add
autocomplete="off"to each input you want to protect. For example:<input type="text" name="email" autocomplete="off">. This is the most reliable single-field method. - Handle password fields separately. Browsers often ignore
autocomplete="off"ontype="password". Useautocomplete="new-password"for sign-up or password-reset forms, andautocomplete="current-password"for login forms. This tells the browser not to suggest a saved password where it should not. - Consider
autocomplete="nope"as a fallback. Some developers use a non-standard value likenopebecause certain browsers treat unknown values as "off". This is not guaranteed by the HTML spec, so use it only as an extra layer, not the primary method. - Test in each target browser. Open the form, type a value, submit it, then reload the page and start typing again. Check whether the browser offers a dropdown of previous entries. Repeat in Chrome, Firefox, Safari, and Edge. Note that browser settings (like "Save form data") can override your attribute.
- Clear the browser's saved form data for testing. If you previously submitted the form, the browser may already have stored values. Clear autofill data in the browser settings before retesting, or use a private/incognito window.
- Check for JavaScript overrides. Some form libraries or scripts set
autocompletedynamically. Inspect the rendered HTML in DevTools to confirm the attribute is present on the live element, not just in the source file.
Common Mistakes
- Using only
autocomplete="off"on the form. Many browsers still autofill individual fields. Add the attribute to each input as well. - Expecting
offto work on password fields. Browsers deliberately ignore it there. Usenew-passwordorcurrent-password. - Forgetting that browser settings can override the attribute. If the user has enabled "Save form data" or a password manager, the browser may still offer suggestions. You cannot fully control user-side settings.
- Placing the attribute on the wrong element. It must be on the
<input>or<form>, not on a wrapper<div>. - Assuming one browser's behaviour applies to all. Chrome, Firefox, and Safari handle autocomplete differently, especially for passwords and credit-card fields.
Tips
- Use the correct
autocompletetoken for the field's purpose (e.g.,email,tel,name) when you want autofill to work. Useoffonly when you specifically want to block it. - For sensitive fields like one-time codes or captcha inputs,
autocomplete="off"is usually respected. - Test with browser autofill settings both on and off to see the difference.
- Keep a comment in your code explaining why autocomplete is disabled, so future maintainers do not remove it accidentally.
- If you use a front-end framework, check how it renders attributes; some may strip unknown values.
Troubleshooting
If the dropdown still appears, first confirm the attribute is present on the live element using your browser's developer tools. If it is missing, your template or script is overriding it. Next, clear the browser's saved form data and retest in a private window. If the issue persists only in one browser, check that browser's autofill settings; some users enable "Save and fill" which can ignore the attribute. For password fields, switch to new-password or current-password. If you use a JavaScript framework, ensure the attribute is not being removed during rendering. Finally, remember that no attribute can force a user to stop using their browser's password manager; you can only request that the browser not offer suggestions.
Frequently Asked Questions
Does autocomplete="off" work in all browsers?
No. Most browsers respect it for regular text fields, but behaviour varies. Password fields often ignore it, and some browsers may still autofill based on user settings.
What is the difference between autocomplete="off" and autocomplete="new-password"?
off asks the browser not to remember or suggest values. new-password tells the browser this is a new password field, so it should not offer a saved password but may offer to generate one.
Can I disable autocomplete for just one field?
Yes. Add autocomplete="off" to that specific <input> tag. It overrides the form-level setting for that field.
Why does the browser still show suggestions after I set autocomplete="off"?
The browser may have already saved values from previous submissions, or the user's autofill settings may override the attribute. Clear saved form data and test again.
Is autocomplete="nope" a valid workaround?
It is not part of the HTML standard. Some browsers treat unknown values as "off", but it is not reliable. Use off as the primary method.
Does disabling autocomplete affect accessibility?
It can. Autofill helps users with motor impairments or cognitive disabilities. Disable it only when necessary, such as for sensitive or one-time fields.