Disabling Chrome Autofill

905,397

Solution 1

Jan 2021: autocomplete="off" does work as expected now (tested on Chrome 88 macOS).

For this to work be sure to have your input tag within a Form tag


Sept 2020: autocomplete="chrome-off" disables Chrome autofill.


Original answer, 2015:

For new Chrome versions you can just put autocomplete="new-password" in your password field and that's it. I've checked it, works fine.

Got that tip from Chrome developer in this discussion: https://bugs.chromium.org/p/chromium/issues/detail?id=370363#c7

P.S. Note that Chrome will attempt to infer autofill behavior from name, id and any text content it can get surrounding the field including labels and arbitrary text nodes. If there is a autocomplete token like street-address in context, Chrome will autofill that as such. The heuristic can be quite confusing as it sometimes only trigger if there are additional fields in the form, or not if there are too few fields in the form. Also note that autocomplete="no" will appear to work but autocomplete="off" will not for historical reasons. autocomplete="no" is you telling the browser that this field should be auto completed as a field called "no". If you generate unique random autocomplete names you disable auto complete.

If your users have visited bad forms their autofill information may be corrupt. Having them manually go in and fix their autofill information in Chrome may be a necessary action from them to take.

Solution 2

I've just found that if you have a remembered username and password for a site, the current version of Chrome will autofill your username/email address into the field before any type=password field. It does not care what the field is called - just assumes the field before password is going to be your username.

Old Solution

Just use <form autocomplete="off"> and it prevents the password prefilling as well as any kind of heuristic filling of fields based on assumptions a browser may make (which are often wrong). As opposed to using <input autocomplete="off"> which seems to be pretty much ignored by the password autofill (in Chrome that is, Firefox does obey it).

Updated Solution

Chrome now ignores <form autocomplete="off">. Therefore my original workaround (which I had deleted) is now all the rage.

Simply create a couple of fields and make them hidden with "display:none". Example:

<!-- fake fields are a workaround for chrome autofill getting the wrong fields -->
<input style="display: none" type="text" name="fakeusernameremembered" />
<input style="display: none" type="password" name="fakepasswordremembered" />

Then put your real fields underneath.

Remember to add the comment or other people on your team will wonder what you are doing!

Update March 2016

Just tested with latest Chrome - all good. This is a fairly old answer now but I want to just mention that our team has been using it for years now on dozens of projects. It still works great despite a few comments below. There are no problems with accessibility because the fields are display:none meaning they don't get focus. As I mentioned you need to put them before your real fields.

If you are using javascript to modify your form, there is an extra trick you will need. Show the fake fields while you are manipulating the form and then hide them again a millisecond later.

Example code using jQuery (assuming you give your fake fields a class):

$(".fake-autofill-fields").show();
// some DOM manipulation/ajax here
window.setTimeout(function () {
  $(".fake-autofill-fields").hide();
}, 1);

Update July 2018

My solution no longer works so well since Chrome's anti-usability experts have been hard at work. But they've thrown us a bone in the form of:

<input type="password" name="whatever" autocomplete="new-password" />

This works and mostly solves the problem.

However, it does not work when you don't have a password field but only an email address. That can also be difficult to get it to stop going yellow and prefilling. The fake fields solution can be used to fix this.

In fact you sometimes need to drop in two lots of fake fields, and try them in different places. For example, I already had fake fields at the beginning of my form, but Chrome recently started prefilling my 'Email' field again - so then I doubled down and put in more fake fields just before the 'Email' field, and that fixed it. Removing either the first or second lot of the fields reverts to incorrect overzealous autofill.

Update Mar 2020

It is not clear if and when this solution still works. It appears to still work sometimes but not all the time.

In the comments below you will find a few hints. One just added by @anilyeni may be worth some more investigation:

As I noticed, autocomplete="off" works on Chrome 80, if there are fewer than three elements in <form>. I don't know what is the logic or where the related documentation about it.

Also this one from @dubrox may be relevant, although I have not tested it:

thanks a lot for the trick, but please update the answer, as display:none; doesn't work anymore, but position: fixed;top:-100px;left:-100px; width:5px; does :)

Update APRIL 2020

Special value for chrome for this attribute is doing the job: (tested on input - but not by me) autocomplete="chrome-off"

Solution 3

After months and months of struggle, I have found that the solution is a lot simpler than you could imagine:

Instead of autocomplete="off" use autocomplete="false" ;)

As simple as that, and it works like a charm in Google Chrome as well!


August 2019 update (credit to @JonEdiger in comments)

Note: lots of info online says the browsers now treat autocomplete='false' to be the same as autocomplete='off'. At least as of right this minute, it is preventing autocomplete for those three browsers.

Set it at form level and then for the inputs you want it off, set to some non-valid value like 'none':

<form autocomplete="off"> 
  <input type="text" id="lastName" autocomplete="none"/> 
  <input type="text" id="firstName" autocomplete="none"/>
</form>

Solution 4

Sometimes even autocomplete=off won't prevent filling in credentials into wrong fields.

A workaround is to disable browser autofill using readonly-mode and set writable on focus:

 <input type="password" readonly onfocus="this.removeAttribute('readonly');"/>

The focus event occurs at mouse clicks and tabbing through fields.

Update:

Mobile Safari sets cursor in the field, but does not show virtual keyboard. This new workaround works like before, but handles virtual keyboard:

<input id="email" readonly type="email" onfocus="if (this.hasAttribute('readonly')) {
    this.removeAttribute('readonly');
    // fix for mobile safari to show virtual keyboard
    this.blur();    this.focus();  }" />

Live Demo https://jsfiddle.net/danielsuess/n0scguv6/

// UpdateEnd

Explanation: Browser auto fills credentials to wrong text field?

filling the inputs incorrectly, for example filling the phone input with an email address

Sometimes I notice this strange behavior on Chrome and Safari, when there are password fields in the same form. I guess, the browser looks for a password field to insert your saved credentials. Then it autofills username into the nearest textlike-input field , that appears prior the password field in DOM (just guessing due to observation). As the browser is the last instance and you can not control it,

This readonly-fix above worked for me.

Solution 5

If you are implementing a search box feature, try setting the type attribute to search as follows:

<input type="search" autocomplete="off" />

This is working for me on Chrome v48 and appears to be legitimate markup:

https://www.w3.org/wiki/HTML/Elements/input/search

Share:
905,397
templaedhel
Author by

templaedhel

Updated on July 17, 2022

Comments

  • templaedhel
    templaedhel almost 2 years

    I have been running into issues with the chrome autofill behavior on several forms.

    The fields in the form all have very common and accurate names, such as "email", "name", or "password", and they also have autocomplete="off" set.

    The autocomplete flag has successfully disabled the autocomplete behavior, where a dropdown of values appear as you start typing, but has not changed the values that Chrome auto-populates the fields as.

    This behavior would be ok except that chrome is filling the inputs incorrectly, for example filling the phone input with an email address. Customers have complained about this, so it's verified to be happening in multiple cases, and not as some some sort of result to something that I've done locally on my machine.

    The only current solution I can think of is to dynamically generate custom input names and then extract the values on the backend, but this seems like a pretty hacky way around this issue. Are there any tags or quirks that change the autofill behavior that could be used to fix this?

  • Nicu Surdu
    Nicu Surdu about 11 years
    For the workaround solution: wouldn't this make the password field autofilled nevertheless ? And thank you for the edit solution. I would leave only that as an answer.
  • mike nelson
    mike nelson about 11 years
    Good point, removed that workaround and now just has the solution.
  • lucasarruda
    lucasarruda over 10 years
    Thanks for sharing this info. Was having this very same weird behavior and wasn't understanding why it happens until you clarify. On my case, it only happened when I turned autocomplete="on". That was why I wasn't experiencing this issue before.
  • goodeye
    goodeye over 10 years
    Excellent answer for the reason. For the solution, I'm trying this, as well as stackoverflow.com/q/10938891/292060. I'd prefer to turn off autofill, but keep autocomplete.
  • parliament
    parliament about 10 years
    I was so sure this would work as you explained perfectly the heuristic autofill I'm experiencing with input before password field. Unfortunately, it didn't work for me, I put autocomplete="off" on both the form and all the inputs and they still get filled. The only solution that worked for me is in goodeye's link above. (placing a second hidden type="password" input before the password throws off chrome's heuristic checks)
  • Ham Za
    Ham Za about 10 years
    This used to work fine, I used it too, but since a Chrome upgrade some time ago (between then and May 5th), Chrome ignores the form property :(
  • Ham Za
    Ham Za about 10 years
    This doesn't work well for me: chrome still autofills the password field visibly, while the username is indeed hidden.
  • Jobin
    Jobin about 10 years
    yes its not for password its for user name if you need password too try to create a password fake field too.check my edit
  • Jammer
    Jammer almost 10 years
    Google took the decision in (Chrome v34 I think) to make it policy to ALWAYS now ignore autocomplete="off", including form level directives ... that would be fine if it actually got the damn fields right.
  • mike nelson
    mike nelson almost 10 years
    Thanks for the comments, I've tried it again myself also and agree my old solution no longer works, so have updated with the latest solution.
  • carbontwelve
    carbontwelve almost 10 years
    It is incredibly annoying that google decided to make chrome ignore the autocomplete attribute - it kept autofilling a user record edit form with the admins login details until I found your work around. Thanks.
  • Jeffrey Simon
    Jeffrey Simon almost 10 years
    This one worked for me (for now). I have found that I have used about a half dozen different hacks over time, and after a while Chrome decides it wants to defeat that hack. So a new one is needed, such as this one. In my application, I have a profile update form with email and password fields that are to be left blank unless the user wants to make changes. But when Chrome autofills, it puts the userid in the "email confirmation" field, resulting in all kinds of error conditions, that lead to further error conditions, as the user flounders about trying to do the right thing.
  • Mark42
    Mark42 almost 10 years
    The solution does indeed work but it's ridiculous that such a kludge is even necessary. When a dev codes autocomplete=off into a form, it's usually for a good reason. No means no, Chrome! Discussion of the issue: code.google.com/p/chromium/issues/detail?id=352347
  • Patrick Cullen
    Patrick Cullen over 9 years
    you can remove the name attributes so these fake params aren't posted to server
  • MrBoJangles
    MrBoJangles over 9 years
    A quick explanation as to why this hack works (for now): Chrome sees the first type=password input and autofills it and it assumes that the field directly before this MUST be the userhame field, and autofills that field with the username. @JeffreySimon this should explain the phenomenon of userid in email confirmation field (I was seeing the same thing on my form).
  • Jeffrey Simon
    Jeffrey Simon over 9 years
    I suspect it won't be long before Chrome figures out how to defeat this hack. Why does Chrome try to hard to prevent a function that should be up to the developer?
  • qmo
    qmo over 9 years
    Thanks for the workaround. I had to change a bit by putting the fake username before the real one and fake password after the the real one.
  • mike nelson
    mike nelson over 9 years
    @qmo - why did you have to do that? It usually works fine having both fake user and fake password before the real ones.
  • qmo
    qmo over 9 years
    @mikenelson It didn't work for me, Chrome picked up the fake username + the real password. Btw, I'm using Chrome 39.
  • Roey
    Roey over 9 years
    what a great fix :) you should replace jquery with this: this.removeAttribute("class")
  • mistertodd
    mistertodd over 9 years
    @Mark42 The reason all browsers had to start ignoring it is because developers would put it there without good reason. E.g. Managers, lawyers, legal department, HIPAA, and Sarbanes–Oxley are not valid reasons to disable autocomplete. But that didn't stop developers from bowing to pressure from the U.S. government. The better way to not auto-complete passwords is to tell Chrome to not remember your password.
  • praniclift
    praniclift about 9 years
    Even better: remove the name="" attributes on both inputs and that information never even gets posted to your server, but it still fools Chrome.
  • ComfortablyNumb
    ComfortablyNumb about 9 years
    I used this to stop a dropdwonlist from being autofilled. But also restyled readonly so it didn't look it. Cool idea!
  • kentcdodds
    kentcdodds about 9 years
    This is the only solution that actually works. I really don't like it, but that's the crummy state we're in right now :-(
  • kentcdodds
    kentcdodds about 9 years
    Unfortunately, this applies to more than just username/password type things. Chrome will look at the placeholder text to infer what to suggest. For example: jsbin.com/jacizu/2/edit
  • kentcdodds
    kentcdodds about 9 years
    Unfortunately, this no longer works :-( jsbin.com/sobise/edit?html,css,output
  • Bernesto
    Bernesto about 9 years
    It is valid that you will still be able to fill the fields with browser suggestions as your example demonstrates, so this doesn't really address the OPs issue. This solution, just prevents the browser from "automatically" populating username and passwords combos as in the example by the top answer. This may be of use to some, but is not an end-all solution to just disabling autocomplete, that will have to come from Google.
  • Bernesto
    Bernesto about 9 years
    Although, if you add a space in front of your placeholder text it will disable the auto-suggest based on placeholder too. Definitely a hack, although no more so than the other suggestions. jsbin.com/pujasu/1/edit
  • kentcdodds
    kentcdodds about 9 years
    actually... it seemed to work for your example, but for some reason it's not working for me :-(
  • dsuess
    dsuess about 9 years
    @kentcdodds: Chrome update: Google released Chrome v41 on March 19th, but I can not find any specific note in their change log. Please specify your comment: The initial question was, how to prevent Chrome from filling saved values to wrong field names. How does your example code behave? In your example I notice 3x text-input fields, without name attribute and no surrounding form tag.
  • Bernesto
    Bernesto about 9 years
    Ha! That's why it's called a hack... Do you have an example you can share where it's not working?
  • mike nelson
    mike nelson about 9 years
    @kentcdodds - not sure what you mean about no longer working. Your jsbin does not have a password field so is a different situation. I've been using this solution for years and most recently I noticed it was needed and it worked for me just last week (March 2015).
  • M. Eriksson
    M. Eriksson about 9 years
    Yes it does. I just used the above solution. And your jsbin works as well. Chrome 41. :)
  • Yesudass Moses
    Yesudass Moses about 9 years
    This will become a big security issue ?? If the user mistakenly click the "save password", and he doesn't view any passwords on the login textboxes. He will think that there's no password saved. but its still saved, and recoverable by Javascript :/
  • ng-darren
    ng-darren about 9 years
    Hi guys, this solution doesn't work. Tried on both Chrome 41 and 42. So I twisted the hack by inserting invisible spans into the label instead. It worked beautifully on Chrome 41 and 42. - <label for="address">Registered Add<span style="display:none">This is to make Chrome to not autocomplete</span>ress: </label>
  • roughcoder
    roughcoder about 9 years
    try autocomplete="false" not autocomplete="off"
  • Fery Kaszoni
    Fery Kaszoni about 9 years
    It does work very well Aaron, in all major browsers ;)
  • Clint
    Clint about 9 years
    In Chrome, the readonly attribute trumps the required attribute on an input which breaks client side validation.
  • dsuess
    dsuess about 9 years
    @Clint: My code snippet above removes the readonly attribute as soon as the user enters the field (per mouse click or tab key). I guess, you refer to a field, which is auto fill protected, but not touched by the user. What is this field purpose - and does it really need to be protected? Depending on the scenario, removing all readonly attributes on submit may be an option. Can you add a more specific comment on your issue? Maybe I can help you out :)
  • Dvd Franco
    Dvd Franco almost 9 years
    Worked for me! But there is one important remark: I have 5 fields in my web page: Name, Address, Zip code, Phone and Email. When I included autocomplete='false' on the Form and on the Name field, it still worked. However, when I included the autocomplete='false' also on the Address field, it finnally stopped autofilling them! So, you need to put the autocomplete property not on the login or name field, but on the following fields too! (Worked on Chrome 43.0.2357.81 as of 2015-05-27)
  • genkilabs
    genkilabs almost 9 years
    IF THIS DOES NOT WORK FOR YOU: Keep in mind that there are 2 ways Chrome "helps" users. AUTOCOMPLETE will prompt based on previous submission in the same form filed and will affect people who are using the form more than once. Autocomplete is disabled with autocomplete="off". AUTOFILL will prompt based on the address book from previously filled out similar forms on other pages. It will also highlight the fields it is changing. Autofill can be disabled with autocomplete="false".
  • Loenix
    Loenix almost 9 years
    This is not an elegant solution, using bootstrap the field is styled as a readonly input but this is not one.
  • dsuess
    dsuess almost 9 years
    @Loenix: your sample is about a different answer and uses autocomplete="off", while my solution is about the readonly attribute. Btw. I guess there is a little typo in the fiddle you listet. The event listener $(this).one("focus... should likely be $(this).on("focus.... Kind regards, dsuess
  • Loenix
    Loenix almost 9 years
    @dsuess This script apply the readonly solution on a field with autocomplete="off". It uses one jQuery method to apply event only one time, because after the first focus event, the readonly attribute is already removed (here i respect jQuery standards, we should edit the property and not the attribute). api.jquery.com/one
  • Walid Ammar
    Walid Ammar almost 9 years
    It worked with little modification, $timeout(function() { element.val("") }, 300)
  • rybo111
    rybo111 almost 9 years
    This doesn't work for me (Version 43.0.2357.124 m). This was probably an oversight by Google, which has now been resolved. They seem to be thinking "the user is always right" in that they want to autofill everything. The problem is, my registration form saves the user data just like the login form does, which is most definitely not what the user wants...
  • rybo111
    rybo111 almost 9 years
    This attribute is also required: autocomplete="I told you I wanted this off, Google. But you would not listen."
  • rybo111
    rybo111 almost 9 years
    Hooray! A solution that seems to work! I would advise giving the field the name password and having actual_password for the legitimate field, as Google now seem to be looking at the name. However, this means Chrome won't then save the password, which is the functionality I actually want. AAAAARRRRGHH!
  • rybo111
    rybo111 almost 9 years
    If you're using JavaScript. why not just set the value to dummy and then remove the value again? Adding and removing readonly sounds like a hazardous move - what if the browser doesn't want you to focus on it?
  • cyberskunk
    cyberskunk almost 9 years
    It worked for me even without name attribute. But I had to add non-empty value attributes to prevent FF (38.0.5) from autocompleting these hidden inputs.
  • rybo111
    rybo111 almost 9 years
    @Vaia - have you tried navigating to another page and then pressing the back button? I get mixed results - it may need tweaking.
  • AlexioVay
    AlexioVay almost 9 years
    I haven't tried option 1 if you mean that. Also I just needed to disable the autofill on an ajax-loaded modal that won't be called with the back button. But if there will be other results, I'll tell you. @rybo111
  • rybo111
    rybo111 almost 9 years
    @Vaia I meant option 2 - please reply here if you encounter any problems. Thanks.
  • Adriano Rosa
    Adriano Rosa almost 9 years
    YEP It works in Chrome 43.0.2357!! this behaviour in Chrome is so annoying, and this workaround took me a while to figure out. Thanks for your answer.
  • DestyNova
    DestyNova almost 9 years
    It might not work on old browsers, base on a old 2005 post from Scott Hanselman's blog: hanselman.com/blog/…
  • Jim G.
    Jim G. almost 9 years
    @MagnusEriksson: No. The jsbin does not work. Chrome 43.0.2357.134
  • Kevin
    Kevin almost 9 years
    'new-password' worked for me after trying 'off' and 'false'
  • Noel Abrahams
    Noel Abrahams almost 9 years
    I would not recommend this solution. Setting autocomplete to "false" works in Chrome but FireFox ignores it.
  • Fery Kaszoni
    Fery Kaszoni almost 9 years
    Noel Abrahams, the question here was about Chrome and not about Firefox!
  • Anas
    Anas almost 9 years
    Worked on Chrome V 44, see documentation here: developers.google.com/web/fundamentals/input/form/…
  • David
    David almost 9 years
    This is the only working fix now. False, and off, do not work anymore. Should be the correct answer now.
  • Rob Scott
    Rob Scott almost 9 years
    Works for Version 44.0.2403.130 m - only thing that worked for me!
  • Mattijs
    Mattijs over 8 years
    doesnt work with Chrome 44.0.2403.157. How can this feature work and not work with different versions. It is ridiculous
  • Mattijs
    Mattijs over 8 years
    Yes, I can confirm that next to the 2 fake fields, you need autocomplete="off" in your form element. This is hilarious :)
  • John Little
    John Little over 8 years
    This does not work for me, chrome still auto fills lastname and password for new accounts. chrome is ignoring autocomplete attribute.
  • MrBoJangles
    MrBoJangles over 8 years
    This solution briefly worked, I guess. Not so much anymore. At least, not in our angular site.
  • MrBoJangles
    MrBoJangles over 8 years
    Update: This continues to work over a year since the last time I implemented it. We may have a solid winner here.
  • J.T. Taylor
    J.T. Taylor over 8 years
    See my answer here for a reliable workaround: stackoverflow.com/questions/12374442/…
  • artdias90
    artdias90 over 8 years
    @roughcoder what autocomplete=false did not make it work. Its the same as autocomplete=off, chrome doesnt care
  • The Muffin Man
    The Muffin Man over 8 years
    @GrahamT Might want to check your code, I just updated to 46.0.2490.80 m and it works.
  • H. Ferrence
    H. Ferrence over 8 years
    This poses a huge and serious security exposure. Any site can harvest usernames and passwords, ip addresses from the client, and a host of other _SERVER variable info. I just proved it on my site by looking at the _POST vars submitted. And I thought Google was smart. Fooled me.
  • dlsso
    dlsso over 8 years
    @Toolkit Works for me on Chrome 46.0.2490.80. I think it's something other than browser version that's the problem.
  • Toolkit
    Toolkit over 8 years
    wow Chrome, you surprise me, is there some bug submitted or whatever?
  • Joe Heyming
    Joe Heyming over 8 years
    It's not really the fact that you say PreventChromeAutocomplete. I was able to get autocomplete to work by saying autocomplete="off" and name="somename". But this only works if you name two different inputs the same name. So in your case PreventChromeAutocomplete must have been applied to two different inputs. Very strange...
  • Olivier Pons
    Olivier Pons over 8 years
    This is both the most effective way but the worse hackish way. It's how the web works: not good job, clean job. No. Hacks, hacks, hacks, hacks, hacks, hacks, hacks, hacks. I'm fed up with that.
  • Theo Orphanos
    Theo Orphanos over 8 years
    I tried autocomplete="false" and didn't work on Chrome 47.0.2526.106... However when I use: autocomplete="off" in the "form" tag as well as in every "input" tag that works great!
  • www139
    www139 over 8 years
    It worked for me but you have to assign it to a specific input element. It will not work if you apply this to the <form> element.
  • Victor F
    Victor F over 8 years
    It looks like this just stopped working in Chrome v48.0.2564.82 m
  • Tom Rossi
    Tom Rossi over 8 years
    I tried all the previously mentioned fixes and none worked for me on Version 47.0.2526.111 (64-bit)
  • Adam Jimenez
    Adam Jimenez over 8 years
    Yes it stopped working - it's like an arms race. I solved it with: <div style="height:0; overflow: hidden;"> <input type="text" name="fakeusernameremembered"> <input type="password" name="fakepasswordremembered"> </div>
  • Victor F
    Victor F over 8 years
    @AdamJimenez, the problem with your solution is that a person can Tab into the invisible field, which is not a good thing. I got it working with solution by hyper_st8 below.
  • Adam Jimenez
    Adam Jimenez over 8 years
    @VictorF Ahh, thanks for the heads up I will use that also. It's like an arms race!
  • Stijn Geukens
    Stijn Geukens over 8 years
    @mikenelson: any idea why the solution (fakeusernameremembered) works?
  • scebotari66
    scebotari66 over 8 years
    this doesn't work in the latest Chrome (48.0.2564.109). when the fake input is visible, it captures the autofill, but when it's hidden via display none - it doesn't. I tried to absolutely position the fake input and give it 0 width and height, also doesn't work. The only way I managed to make it work is with height of 1px.
  • Jacka
    Jacka over 8 years
    strange fix but somehow that's the only thing that works for me on chrome 48 :)
  • David
    David about 8 years
    This actually killed the entire form autofill options not just the field for me.
  • Liorsion
    Liorsion about 8 years
    Small comment: I've noticed it only works if the fields were AFTER my real fields (ie Chrome was taking the last field to autofill)
  • epelc
    epelc about 8 years
    Thank you! This is the only thing that works in chrome 49. Previous methods broke as chrome seems to fill all inputs with type="password" now.
  • ymerej
    ymerej about 8 years
    @Liorsion So that worked for me, until I updated to v49 today. It seems like they reverted back to only working if you put it before the real fields. Can't seem to win. Not sure what is up with their developers constantly f'ing with this. People complain about IE, but man, they are making themselves look just as bad. Anyway I've now added these fake fields to before and after the real fields
  • Admin
    Admin about 8 years
    Great work, how did you find out the algorithm of Chrome? I just found out that my old method changing the value with JS after the page has been loaded with a setTimeout timer doesn't work anymore. But this works perfect!
  • Liam
    Liam about 8 years
    Great this is the only one that worked on v49 for me Thanks
  • Colin Wiseman
    Colin Wiseman about 8 years
    This appears to be broken now on version Version 49.0.2623.110 m. Testing: cleared all passwords for the domain, logged in on one form and saved the password, went back to my create account form and the fields were filled in and the hidden fields were still there. Chrome is painful!
  • eYe
    eYe about 8 years
    Unfortunately, does not work for regular TextBox inputs.
  • Fareed Alnamrouti
    Fareed Alnamrouti about 8 years
    actually it is working just set the name property ;)
  • Tauras
    Tauras about 8 years
    Updated my chrome, and still it does work for me. 50.0.2661.87 (64bit)
  • agarcian
    agarcian about 8 years
    This is something that actually worked for me after other attempts. I am using Chrome 50.
  • MrFabio
    MrFabio about 8 years
    Works 100%. Simple and effective. Thank you so much, tested on 50.0.2661.94 m
  • Urs
    Urs about 8 years
    <form autocomplete="off"> worked for me in Chrome 50something
  • Ixalmida
    Ixalmida about 8 years
    This worked for me, but only after I named the fields the same as the existing fields (name="email" / name="password"). It made no difference where the fake fields are in the form (I placed them at the top). Input type also doesn't seem to matter (works with no type tag). My Chrome version is 50.0.2661.102 m.
  • rybo111
    rybo111 almost 8 years
    I concur with @Ixalmida - there have been changes to Chrome and the style="display:none" trick now only works if you use the correct input name (e.g. name="email"). You don't need a password field, it seems.
  • sibbl
    sibbl almost 8 years
    Unfortunately, when submitting the form (or when the input fields are hidden/removed), Chrome then asks to save the changed login.
  • sibbl
    sibbl almost 8 years
    Unfortunately Chrome then asks the user to save the changed password when the form is submitted/hidden.
  • Jack
    Jack almost 8 years
    If I add the two hidden fields above, Chrome fills it in and then carries on and fills all the rest in as well! Wtf Chrome
  • Geoffrey Hale
    Geoffrey Hale almost 8 years
    Works in Version 51.0.2704.79 m
  • Geoffrey Hale
    Geoffrey Hale almost 8 years
    Works in Version 51.0.2704.79 m
  • Geoffrey Hale
    Geoffrey Hale almost 8 years
    This does not work. Use autocomplete="new-password" (stackoverflow.com/a/30976223/1438029). Verified works in Version 51.0.2704.79 m.
  • Joe RR
    Joe RR almost 8 years
    holy f*** why this works? is that a bug? because i tested it here and place it only in one input and worked for both input login and password, but i put it only in the password
  • Tauras
    Tauras almost 8 years
    I have no idea. I think thats a chrome "thing" which was made by developers. Maybe i am mistaken.
  • Denis
    Denis almost 8 years
    As for June of 2016 and Chrome 51.0.2704.106 m this is the only working solution over here
  • AlexioVay
    AlexioVay almost 8 years
    But will the form select the right (visible) input field you need then? Because it's the same name.
  • dlsso
    dlsso almost 8 years
    Not working for me (on mobile, non-password field). Shows up as autocomplete="off" in the HTML, which of course doesn't work.
  • dlsso
    dlsso almost 8 years
    July 20 2016, neither this nor new-password are working for me on mobile for a non password field. Tried matching name, putting hidden fields both before and after, and JS hack. Chrome 51.0.2704.81
  • Ariel
    Ariel almost 8 years
    Worked perfectly on Chrome 51.0.2704.103 m (64-bit)
  • gozizibj
    gozizibj almost 8 years
    It prevent autofill, but how to disable autocomplete for password field
  • Olive
    Olive over 7 years
    @Daniel, works in Version 52.0.2743.116 (64-bit) on macOS (10.12 Beta (16A304a)) - At least for me.
  • mccainz
    mccainz over 7 years
    @Vaia, adding the disabled attribute to the duplicate element will prevent it from being submitted.
  • danjarvis
    danjarvis over 7 years
    This solution worked because it does two things: 1. prevents chrome from displaying the 'use password for' under the real password field and 2. prevents chrome from asking you if you want to save the updated password (since the hidden password field which is marked as 'new-password' has no value)
  • AlexioVay
    AlexioVay over 7 years
    Do you have any sources how to figure this out?
  • Deminetix
    Deminetix over 7 years
    After 2 hours trying other suggestions this works! Chrome 54.0.2840.71
  • Deminetix
    Deminetix over 7 years
    The reason this works is because the chrome team are trying to create recommended autocomplete values, as shown @ developers.google.com/web/fundamentals/design-and-ui/input/… The "new-password" value is one of the few that have additional logic surrounding it, and in this case, its to suspend autofill but still allow autocomplete suggestions
  • Robin Andrews
    Robin Andrews over 7 years
    Works, but is not semantic as can be used on username and other fields.
  • Mikal Schacht Jensen
    Mikal Schacht Jensen over 7 years
    Using this approach I found that Firefox would still autofill the hidden fields, which would then be posted along with the rest of the form when submitting. Something that is not desirable with your credentials. Adding maxlength="0" prevents that.
  • Travis Tubbs
    Travis Tubbs over 7 years
    It stinks that there is not a better solution than this... (no offense to you @mikenelson) offense to google chrome.
  • Brian Chance
    Brian Chance over 7 years
    This stopped working for me as of Chrome 56. It started autofilling passwords for non-matching field names. Changed both inputs from style=display:none to style="visibility:hidden;height:0;width:1px;position:absolut‌​e;left:0;top:0". Thanks to @digital_flowers and @CodeSimian answers.
  • Sajjan Sarkar
    Sajjan Sarkar about 7 years
    Stopped working on Chrome 56.0.2924.87 . But the autocomplete="off" on the input worked.
  • Arnold Roa
    Arnold Roa about 7 years
    This does not work, both inputs, fake and new are yellow-autocompleted :(
  • Kuf
    Kuf about 7 years
    @ArnoldRoa version added, it's been on our site since the day I've posted it and had few versions where it worked fine. which version are you using? PC/Mac?
  • MiVvlt
    MiVvlt about 7 years
    still works for me though, can you give some more details about what you are doing? Also: did you put the div with hidden inputs before the visible ones?
  • Admin
    Admin about 7 years
    Not working on 57.0.2987.110. Chrome highlights it yellow and prefill the field with my saved password. But the page is a user management page, not login page.
  • Kuf
    Kuf about 7 years
    @Dummy I tested it now on chrome latest (57) and it's still working for me. Did you do anything special with the input fields? cap you put your code somewhere I could try to reproduce?
  • Louys Patrice Bessette
    Louys Patrice Bessette about 7 years
    As of 2017, this one still works fine. It just needs this script to force input focus if the user clicks on the "fake" placeholder : $("label").on("click",function(){ $(this).prev().focus(); }); Note that the label cannot be before the input... Chrome finds it! Nice creative solution! +1
  • Mayrhofer
    Mayrhofer about 7 years
    the fake fields need to be after your real user/psw fields in dom - works in any browser (win & mac) for me.
  • Kevin Haag
    Kevin Haag almost 7 years
    Setting autocomplete="new-password" is the only thing that worked for me.
  • cristiancastrodc
    cristiancastrodc almost 7 years
    On Chrome 58 this does not work. Use width:1px. If the password field is completely hidden, then Chrome autofills it normally. Also z-index:-999 could be useful so it does not overlap any content.
  • Admin
    Admin almost 7 years
    This answer works for me **** 6/5/2017 *** Version 58.0.3029.110 (64-bit)
  • jtate
    jtate almost 7 years
    NONE of these solutions, whether it's an answer or something in the comments, are working for me as of Chrome 59. Does anyone have any other suggestions?
  • Victor Soto
    Victor Soto almost 7 years
    Having problems with Chrome 59 as well.
  • The Lazy Coder
    The Lazy Coder almost 7 years
    I was able to get this working again. style="height:0px; opacity:0"
  • Mike Purcell
    Mike Purcell over 6 years
    Tried this in Chrome 60 and doesn't appear to work :(, feels like IE hacking all over again...
  • Mike Purcell
    Mike Purcell over 6 years
    This didn't work as of Version 60. Chrome actually autoselects the first password from the list (along with matching email / name) when focus occurs. :(
  • Mike Purcell
    Mike Purcell over 6 years
    This did not work as of 8.30.2017 Version 60.0.3112.113 (Official Build) (64-bit)
  • Oliver Lloyd
    Oliver Lloyd over 6 years
    For react: autoComplete="new-password"
  • Yuvraj
    Yuvraj over 6 years
    This doesn't work in Chrome 61 as well. Has anyone found any solution to this?
  • Justinas
    Justinas over 6 years
  • Caius Jard
    Caius Jard over 6 years
    Thanks for the pointer of "a password field and the field before it" - worked out, when i changed the input so it was no longer a password field.. The users will have to suffer the inconvenience of seeing their new password, but at least I don't have to implement a password/confirmpassword pair :)
  • PellucidWombat
    PellucidWombat over 6 years
    Not working as of 1.13.2018 Version 63.0.3239.132 (Official Build) (64-bit)
  • PellucidWombat
    PellucidWombat over 6 years
    This works for me as of 1.13.2018 Version 63.0.3239.132 (Official Build) (64-bit)
  • Palaniichuk Dmytro
    Palaniichuk Dmytro over 6 years
    In my case I need only , tested Chrome v63 <input type="password" name="password" class="hidden-fields">
  • albertski
    albertski over 6 years
    Working in Version 63.0.3239.132
  • scipper
    scipper over 6 years
    best approach I found so far! well, at least for Chrome 64 :/
  • stackdave
    stackdave about 6 years
    is working with react 16, Chrome version 64: 'new-password' , I' don't know if work without react
  • Johann Combrink
    Johann Combrink about 6 years
    works like a charm Version 64.0.3282.186 (Official Build) (64-bit)
  • johntrepreneur
    johntrepreneur about 6 years
    This is misleading though, as the field has a grey background indicating to the user that it is disabled (which it is) and shows the banned cursor when hovering over it. Only when the user clicks it, which they wouldn't normally do since the styles tell them not, does it actually start working. It may work, but is counter intuitive IMO and bad UX. I suppose you could add styles to address this though.
  • Regular Jo
    Regular Jo about 6 years
    RE: 'unexpected behavior' This behavior is pushed by Google who believes it knows better than developers how every single page should work. Sometimes I just want a raw password input, zero frills.
  • Regular Jo
    Regular Jo about 6 years
    This no longer works, frustratingly. I have a 'change password' form, and Chrome offers offers Use password for on every single one of them, no matter what I've tried including this.
  • L. Guthardt
    L. Guthardt about 6 years
    While this code snippet may be the solution, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion.
  • billy jean
    billy jean about 6 years
    Version 64.0.3282.186 (Official Build) (64-bit) Windows. 2018-03-01 NOT WORKING for disabling autofill.
  • billy jean
    billy jean about 6 years
    this combination FINALLY worked for me: role="presentation" autocomplete="nope" tested on Chrome Version 64.0.3282.186 (Official Build) (64-bit). What a nightmare!
  • SantiBailors
    SantiBailors about 6 years
    The first colon in the 2nd line is probably a typo.
  • Johannes
    Johannes about 6 years
    I agree with L. Guthardt. Please provide a complete example that showcases your solution, preferably on jsfiddle, jsbin, codepen or similar demo website.
  • Khaleel
    Khaleel about 6 years
    this is the only solution worked for me out of all other workarounds in the internet. this works in safari where I had problem. what a stupid bug and wat a good fix. btw I need to add onblur="this.setAttribute('readonly', true);" to make it work perfectly
  • tleveque
    tleveque about 6 years
    The of using fields with display:none does not work anymore since Chrome 66. Chrome will not autofill if not displayed. You now have to make it invisible. Set the width, height and border to 0 and background transparent (rgba(0,0,0,0))
  • 9swampy
    9swampy about 6 years
    worked in Vue until I updated and memorised the password on the login view again now it's started autofilling again.
  • IQtheMC
    IQtheMC about 6 years
    Can't believe this worked. I added the dummy element to a random username field that is for searching other usernames and didn't have any password field near it, using the bootstrap class 'hidden', then when I loaded the page again the input was clear, but one of my other inputs called Email Address was now populated with the username. So then I had to add a dummy class before the Email Address input and that ID needed to have the words 'email' and 'address'. That solved the problem.
  • curiousguy
    curiousguy about 6 years
    @Mark42 "it's usually for a good reason" It's often for a bad reason (security). Hence, the arm race.
  • Ales
    Ales about 6 years
    For my text input not used for password works this: <input id="townInput" type="text" name="town-name" autocomplete="new-town-name" autocorrect="off">
  • JaySon
    JaySon almost 6 years
    Does not work for me with React and Meteor. Chrome Version 66.0.3359.139
  • Moos
    Moos almost 6 years
    So name or id attribute has to be session-unique so that autofill doesn't kick in. Alternatively leave out name/id and give autocomplete attribute a unique value (like +(new Date())). Examples here: jsfiddle.net/mfdc22pz
  • hungmi
    hungmi almost 6 years
    I copied autocomplete="off" from google map, and it works on chrome version 66.
  • dubrox
    dubrox almost 6 years
    @mikenelson thanks a lot for the trick, but please update the answer, as display:none; doesn't work anymore, but position: fixed;top:-100px;left:-100px; width:5px; does :)
  • Admin
    Admin almost 6 years
    It doesn't work. I'm trying with Chrome 67. Nothing. I still need a fake input with display: none! Very crazy!
  • sKopheK
    sKopheK almost 6 years
    not working in Chrome 67, in Firefox 60 only on first focus, then with no readonly attribute it keeps offering stored passwords for certain user
  • Douwe de Haan
    Douwe de Haan almost 6 years
    Since your answer is the most recent one, could you please add that adding autocomplete="pineapple" or some other gibberish also seems to fix the problem? At least, it did on my end!
  • Sten Muchow
    Sten Muchow almost 6 years
    As of July 2018 - this is working... but must be named new-password
  • ChronoFish
    ChronoFish almost 6 years
    The random string works for chrome but not firefox. For completeness I use both "autocomplete='off-no-complete'" and set the readonly attribute with an onfocus="this.readOnly=false". My app is an enterprise appliation that users use to input thousands of addresses, so the use-case to control this is real - I can also guarantee the use of Javascript, so at least I've got that going for me
  • Junior Mayhé
    Junior Mayhé almost 6 years
    Works on Chrome 67.0 on angular html component <form *ngIf="!loggedIn()" #loginForm="ngForm" class="navbar-form navbar-right" (ngSubmit)="login()"><input type="password" style="width: 0;height: 0; visibility: hidden;position:absolute;left:0;top:0;"/><input type="text" #username="ngModel" placeholder="Username" class="form-control" required autocomplete="off" name="username" [(ngModel)]="model.username"><input type="password" #password="ngModel" placeholder="Password" class="form-control" required autocomplete="off" name="password" [(ngModel)]="model.password">...
  • Matt Morgan
    Matt Morgan almost 6 years
    Worked Google Chrome 67.0.3396.99 (Official Build) (64-bit) (cohort: Stable)
  • Zenoo
    Zenoo almost 6 years
    @mikenelson Since the autocomplete attribute doesn't seem to be doing much lately, I posted an answer which seems to be working, at least for me and the ones who tested it. This question has so many answers I feel like it won't ever be seen. If you deem it good, would you mind adding it to your post? Thank you :)
  • mike nelson
    mike nelson almost 6 years
    @zennoo - your onfocus trick sounds like a good way to disable the autocomplete dropdown that usually appears whereas we are trying to disable autofill which is where it highlights eg Email fields in yellow and puts your email address in them before you even focus the field. Changing the field name does not prevent this behaviour unfortunately
  • ivan_pozdeev
    ivan_pozdeev almost 6 years
    Checking the DOM over a billion times for each received request? No comments.
  • ivan_pozdeev
    ivan_pozdeev almost 6 years
    This inserts that nonbreaking space into the input.
  • Cam Tullos
    Cam Tullos almost 6 years
    You have to make sure the input has a name or id. The browser binds what to autocomplete via attribution. Once you do that, autocomplete='false' should work fine.
  • Cam Tullos
    Cam Tullos almost 6 years
    Sorry... meant autocomplete='off'
  • png
    png almost 6 years
    Autocomplete and autofill are not the same. Using the autocomplete attribute will NEVER disable autofill. I'm guessing that's why this isn't working for half of you. Autofill can only be disabled through the browser settings.
  • png
    png almost 6 years
    @CamTullos, it's true that autocomplete binds to the name attribute. But autocomplete off is doing nothing. You changed the name attribute and therefore no autocomplete values are bound yet.
  • mothmonsterman
    mothmonsterman over 5 years
    autocomplete="off" is working again now as of Chrome Version 68.0.3440.106 (Official Build) (64-bit)
  • mothmonsterman
    mothmonsterman over 5 years
    autocomplete="off" is working again now as of Chrome Version 68.0.3440.106 (Official Build) (64-bit)
  • Andy King
    Andy King over 5 years
    Yes! :) Thank you! This works in Chrome 67.0.3396.99. (I think your link should be: w3.org/wiki/HTML/Elements/input/search as of September 2018).
  • Venson
    Venson over 5 years
    Finally! still works Version 69.0.3497.100 (Official Build) (64-bit) This should be the real answer!
  • Matt
    Matt over 5 years
    This no longer works for me in 69.0.3497.100 (October, 2018).
  • Camille
    Camille over 5 years
    With chrome 69.xxx, I done that to remove stop autocomplete <input type="text"><input type="text" style="display:none"><input type="password"><input type="password" style="display:none">
  • Camille
    Camille over 5 years
    With chrome 69.xxx, I done that to remove stop autocomplete <input type="text"><input type="text" style="display:none"><input type="password"><input type="password" style="display:none">
  • Esko
    Esko over 5 years
    You should edit the question, autocomplete="off" works fine in todays Google Chrome.
  • Day Davis Waterbury
    Day Davis Waterbury over 5 years
    I love you. The only solution on this page that actually works.
  • Zabba
    Zabba over 5 years
    It doesn't work in 70.0.3538.77 (Official Build) (64-bit) @Esko. I think it is safe to say that the Chrome team really doesn't care about a valid use case where you want the auto complete off: in a web app's settings page where you want the user to type in a new email address for their account (the user want's to change the email address on their account)
  • Doug McLean
    Doug McLean over 5 years
    For my purposes this is perfect, thank you! Chrome doesn't autofill or autocomplete it, doesn't offer to save it, and not only is it obscured from view but also from the clipboard - I copied what I'd typed and pasted it into notepad and just got "•••••••••••". Brilliant!
  • ChrisDeDavidMindflowAU
    ChrisDeDavidMindflowAU over 5 years
    actually this works with PHP: ``` <input type="text" name="whatever" autocomplete="off_<?php echo time() ?>"> ``` This disabled the autofill on Chrome at 30-Nov-2018
  • Robert
    Robert over 5 years
    Works the best for me. Thanks for that.
  • redfox05
    redfox05 over 5 years
    It's worth noting that to solve the OP's problem, you don't need to disable autocomplete, you can just give autocomplete labels to tell the browser what type of info the field is for, that way, the right info would more likely go to the right field. See here on the list of autofill attribute values: html.spec.whatwg.org/multipage/…
  • redfox05
    redfox05 over 5 years
    Note: Not every browser has implemented the more specific autofill values, see this page where were they tested which browsers used what to identify fields: cloudfour.com/thinks/…
  • demopix
    demopix over 5 years
    everybody is right and wrong and the same time you should write autocomplete="off" inside the tag <form autocomplete="off" > instead on input and this will stop the autofill behavior
  • Admin
    Admin over 5 years
    Confirmed - this is the only correct answer here that doesn't break proper form structure. Works as of Dec 2018 in all current browsers
  • GerardV
    GerardV over 5 years
    Doesn't work anymore. A working 'solution' (for me) is supplied here: stackoverflow.com/questions/12374442/…
  • digout
    digout over 5 years
    @DouwedeHaan this is fine until the form gets saved, then autocomplete will provide recommendations for saved 'pineapple' field. But maybe using a random hash for autocomplete value for example would get round this?
  • Douwe de Haan
    Douwe de Haan over 5 years
    @digout I agree. A good example would be to use the UUID for this kind of stuff. Just make sure that the string is unique!
  • John
    John over 5 years
    Also works if you set autocomplete="off" on the form (to change that default form-wide) and then just need to set type="search" on the <input>
  • Primoz Rome
    Primoz Rome over 5 years
    @dsuess I am still getting autocomplete box on this example jsfiddle.net/danielsuess/n0scguv6. Google Chrome Version 71.0.3578.98 (Official Build) (64-bit) , OS X Mojave.
  • Richard Garside
    Richard Garside over 5 years
    Original bug has been marked as won't fix. Someone has reopened here bugs.chromium.org/p/chromium/issues/detail?id=914451 please star it if you think this should be fixed.
  • Rob
    Rob over 5 years
    I am not working within a form and I have an input field showing a date in a UL how can I get this to work? THe autocomplete="new-password" still does not stop the autocomplete from trying to fill it in.
  • Olex Ponomarenko
    Olex Ponomarenko over 5 years
    Pretty sure this removes the form / input from assistive technologies w3c.github.io/using-aria/#ariapresentation
  • scrfix
    scrfix over 5 years
    A new approach that I have not seen: The autofill menu in chrome relies on the input type name.
  • scrfix
    scrfix over 5 years
    A new approach that I have not seen: The autofill menu in chrome relies on input type name. Generating and storing a random number for the name prior to form creation then filtering it out if you need to use the name dynamically and upon form submission. Example: <?php $random_num=date().time()*mt_rand(); ?> <input type="text" name="name<?php echo $random_num;?>"> name=name5904923992050214 which would disable the chrome autofill menu from appearing. Since we filtering out 5904923992050214 we can still use the name. This method should work for dynamic language forms.
  • Adam
    Adam over 5 years
    Confirmed this is working Chrome: 71.0 for putting a dummy password element as the first element in your form immediately after <form> open tag - sooo happy!
  • Dzak
    Dzak about 5 years
    Chrome version 72.0.3626.121 (Official Build) (64-bit), This is the only solution that worked for me...
  • westor
    westor about 5 years
    As I learned, autocomplete is not autofill. Therefore setting autocomplete does not help to prevent autofill. Autofill uses e.g. label text around the input, and if it matches to something like 'number', credit card information may be suggested. It seems to be impossible to switch off that. My solution was to modify the label with zero-width witespaces. Assume you have your label information available in js, you may use the following simple code: label = label.split('').join('&#8203;'); In HTML you can simply put a '&#8203;' between parts of your label like 'nu&#8203;mber' or 'ca&#8203;rd'.
  • Adheep Mohamed Abdul Kader
    Adheep Mohamed Abdul Kader about 5 years
    After Chrome version 72.XX, this fix does not work. Find the lastest fixe here stackoverflow.com/a/55045439/1161998
  • MSC
    MSC about 5 years
    FWIW, google's latest explanation: developers.google.com/web/updates/2015/06/…. "In the past, many developers would add autocomplete="off" to their form fields to prevent the browser from performing any kind of autocomplete functionality. While Chrome will still respect this tag for autocomplete data, it will not respect it for autofill data."
  • Prabo
    Prabo about 5 years
    This is the only solution that worked for me. Works in newer versions of chrome too
  • Eddy Howard
    Eddy Howard about 5 years
    I just wanted to say.. After stumbling across this issue.. Chrome is a real piece of work. So now we must jump through hoops to disable functionality that was supposed to remain optional. In what world would address autofill be needed in a business application where the address is new / different every time. Google is becoming just as bad as Microsoft.
  • vijay kumar
    vijay kumar about 5 years
    give name as which field auto populating. .hide-input{ width: 0; height: 0; border: none; position: absolute; } <input type="text" value="" name="username" class="hide-input" />
  • Scratz
    Scratz about 5 years
    The first part of this answer doesn't doesn't appear to be true anymore: Chrome Bug
  • Chris Pratt
    Chris Pratt about 5 years
    I'm not sure what you're on about. That "bug" is just a placeholder for Chromium to collect people's use cases for autocomplete="off". It's possible the intent is to remove it, but that's not ever explicitly stated, and there's certainly nothing requiring that mental leap. They may just be wanting to consider alternate or better ways to treat it. Regardless, it's still part of the spec, and again, no indication that it will be leaving the spec either. And, it still works in all browsers as far as I'm aware, including Chrome.
  • Scratz
    Scratz about 5 years
    We have a couple of cases where autocomplete="off" is not being respected by Chrome.
  • Chris Pratt
    Chris Pratt about 5 years
    1. A couple of anecdotal cases does not amount to evidence. 2. As I said in my answer, form filling extensions and the like may not and often do not respect this. Ultimately, like all things, it's up to the client, and therefore the user. All you can do is suggest that it should not be autofilled.
  • Matt Smith
    Matt Smith about 5 years
    For my purposes I needed to insure the field didn't get auto populated AFTER it lost focus. <input type="password" readonly onfocus="this.removeAttribute('readonly');" onfocusout="this.setAttribute('readonly', 'readonly');"/>
  • jinglesthula
    jinglesthula about 5 years
    Here's where the Chrome autofill source code is. chromium.googlesource.com/chromium/src.git/+/refs/heads/mast‌​er/… Anyone able to dig in and see how it determines fields to target for population? It may be we can defeat the approach it uses as long as we know what the approach is.
  • mkbctrl
    mkbctrl almost 5 years
    This solution is not completely valid. It turns off the autocomplete, but the autofill feature is still intact. Here is the video with the solution: youtube.com/watch?v=tJTaCFdYXrw&feature=youtu.be In order to get rid of both of them, you have to add custom value to the name attribute, set the autocomplete to off, and change the input type to search. And remember the Autofill and Autocomplete are not the same thing in Chrome
  • Kennyomar
    Kennyomar almost 5 years
    Similar for me. I applied it to the password field. Applying to the form or other fields didn't work for me. I'm using Chrome Version 75.0.3770.142
  • Jeffz
    Jeffz almost 5 years
    Does NOT work as of Chrome 75.0.3770.142. Chrome is a mess.
  • Praveen Dabral
    Praveen Dabral almost 5 years
    Worked for me Chrome Version 75.0.3770.142
  • Jon Ediger
    Jon Ediger almost 5 years
    I was able to get a modified version of this working in chrome, firefox, and edge. set autocomplete="off" for the Form element set autocomplete to something invalid, like none, for each input element. Note: lots of info online says the browsers now treat autocomplete='false' to be the same as autocomplete='off'. At least as of right this minute, it is preventing autocomplete for those three browsers. <form autocomplete="off"> <input type="text" id="lastName" autocomplete="none"/> <input type="text" id="firstName" autocomplete="none"/> </form>
  • Fitz
    Fitz over 4 years
    But the suggest will popup as usual when I focus a password type input.
  • Norman Xu
    Norman Xu over 4 years
    Apparently google is trying to make decisions for all of us here, they closed the ticket regarding autocomplete="off": bugs.chromium.org/p/chromium/issues/detail?id=468153. But there is another ticket opened for collecting valid user cases for disabling autofill, please reply this ticket to raise more awareness of this issue here: bugs.chromium.org/p/chromium/issues/detail?id=587466
  • Julesezaar
    Julesezaar over 4 years
    It only works for password autocomplete="new-password", email (="new-email"), username (="new-username") . For all the other fields that DO NOT have the string ..."blabla-password"... "email-blabla"... "bla-username-bla" in the id or name you must still use 'off' to have the best result!
  • V H
    V H over 4 years
    76.0.3809.100 is leaving some random username in some email field in a vuejs site - had to enable it for all form actions due to templates - is causing other side issues now - upon removing it the username no longer appeared in the email field. strange
  • Andres Paul
    Andres Paul over 4 years
    It might sound really odd, but autocomplete= "new-password" only worked for me if the name of the input was name="password" .My previous name was name="old-password" and changing it did the trick. I hope it helps you ;)
  • hkarask
    hkarask over 4 years
    autocomplete="new-password" and not using input name as "password" worked for me.
  • SamJakob
    SamJakob over 4 years
    For some common forms - e.g. username/password, Chrome seems to identify the type attributes of the elements and suggest autofill accordingly, so a workaround for this is to set a form input that would normally be text to number and then after a 500ms setTimeout change the input type back to text.
  • Nucleon
    Nucleon over 4 years
    I was able to get this to work by setting the "name" attribute to Date.now(). I'm using a dynamic input so we don't ever actually use the real name value and it magically worked in Chrome 78... for now.
  • DKR
    DKR over 4 years
    awesome awesome solutions
  • mendez7
    mendez7 over 4 years
    None of the autocomplete attribute values worked for me. I am using Chrome 79.0.3945.88. All I wanted was to disable the autofill suggestion for the password field. I did that by making the input type text in html then changing the type to password in javascript on initialisation of the page. E.g: Html: <input type=text id=myPassword> JS with jquery: $(function () { $('#myPassword').attr('type', 'password')});
  • Codezilla
    Codezilla over 4 years
    The correct answer is now autocomplete="disabled" off and false values do not work anymore
  • GDY
    GDY over 4 years
    I've just used <form autocomplete="off"> in chrome and it works for me
  • 3Dom
    3Dom about 4 years
    This no longer works. Once you've provided details for a field before, it will remember, no matter what you call. It. The solution (to trick it), is to change the name="whatever" and placeholder="whatever" to be unique on every load. In my case, I've added a timestamp (secs since epoch) after those. So they become name="whatever1584167734" and placeholder="whatever1584167734". That fixes it. I have my own autosuggest box which was being out-z-indexed by Chrome's autosuggest.
  • 3Dom
    3Dom about 4 years
    Additionally, I'll add that if you're intending on submitting the form more than once on the same page, you'll need to rename the field attributes after each form submission if you want to stop it from happening.
  • Avatar
    Avatar about 4 years
    You can just add autocomplete="off" to the input field instead of using jquery. And by the way, this does not work. Chrome password suggestions are still showing up.
  • Joshua Soileau
    Joshua Soileau about 4 years
    Thank you thank you thank you. This did it for me. We have an address form where the street input has a custom auto-complete that we implemented, but the chrome AutoFill/AutoComplete always appears on top of ours. This fix did it.
  • anilyeni
    anilyeni about 4 years
    As I noticed, autocomplete="off" works on Chrome 80, IF there is less than 3 elements in <form>. I don't know what is the logic or where the related documentation about it.
  • Nithin Baby
    Nithin Baby about 4 years
    Just to add on, giving autoComplete="new-password" to the password field made sure that other fields like username are also not autofilled now. You don't have to add any extra attributes to fields other than password
  • Pankaja Gamage
    Pankaja Gamage about 4 years
    autocomplete="something-here" used to work but not anymore. Also tried the autocomplete="chrome-off" and it doesn't work either. Just seems like another variation of adding some gibberish for the parameter
  • Matt Smith
    Matt Smith about 4 years
    We run our business on Chrome. It's beyond frustrating that even providing autocomple="someRandomString" no longer works. This needs to be addressed in the standards and Google Chrome needs to adhere to those standards or they too will fall to the sidelines like Netscape Navigator and Internet Explorer.
  • Alex from Jitbit
    Alex from Jitbit about 4 years
    chrome-off worked for me in Chrome 81. Also - how is everyone doing? I've had 2 kids since I first came to this question. Stay healthy!
  • Vladimir
    Vladimir about 4 years
    Just tried chrome-off, didn't work for me, wtf! Chrome 81
  • sagar1025
    sagar1025 almost 4 years
    Update Chrome version 83 - chrome-off does not work, however, using a dummy password field along with the styles seems to work as Mike Nelson mentioned. <input type="password" id="dummy-pwd" style="position: fixed;top:-100px;left:-100px; width:5px;"> Just make sure this input field is of type password and it should be placed BEFORE the real password field. What happens here is the autofill finds the FIRST input field of type password and fills it. In jquery $('#dummy-pwd').val() returns the "autofilled" password while the real password field is empty.
  • Dino
    Dino almost 4 years
    autocomplete="new-password" won't do the auto-fill, but once you click on the password field you will still get a suggestion prompt. I can't believe that it's been years and they still didn't resolve this.
  • auron344
    auron344 almost 4 years
    @sagar1025 Tried it. It doesnt work neither...Its like password manager (no autofill) doesnt give a fuck about how many password inputs you put. It appears for every input you have if it is of type password, simple as that. If you give him the order to store the password you used before, it will always shows to let you choose the password
  • Googie
    Googie almost 4 years
    I noticed that you also need to pay attention to the name attribute of your input. I also named it using new-something-something pattern and it seems to have helped. I missed that previously, as AngularJS assigns the name on-the-fly basing on ng-model value.
  • alfoks
    alfoks almost 4 years
    regarding the new-password, you can read here the expected behaviour. Scroll to "The autocomplete attribute and login fields". developer.mozilla.org/en-US/docs/Web/Security/…
  • virtualmic
    virtualmic almost 4 years
    autocomplete="new-password" works as per: developer.mozilla.org/en-US/docs/Web/HTML/Attributes/…
  • Chuck
    Chuck over 3 years
    Nothing really works here with Chrome. I'm using plain-text boxes now.
  • ddruganov
    ddruganov over 3 years
    "text-security" is not a valid css property as of october 2020
  • Dustexe
    Dustexe over 3 years
    Hello. Had to use autocomplete="off". Chrome version 85+.
  • eheydenr
    eheydenr over 3 years
    Super, thank you, after searching and trying, this finally solved it!
  • Admin
    Admin over 3 years
    Only autocomplete="off" is working for me with Chrome v.85/85 on MacOS 10.15.
  • Thales Kenne
    Thales Kenne over 3 years
    This is the only way I could make it work in 2020: stackoverflow.com/questions/60689757/…
  • Rob
    Rob over 3 years
    Only answer that still actually works at the moment.
  • Craig Howell
    Craig Howell over 3 years
    Version 86.0.4240.111 nothing works. I used to get by with a autocomplete="off" and hidden password and email fields on all forms. I have tried "new-password" "chrome-off" "dont-use-autocomplete I-dont-like-it" nothing has any effect and autocomplete continues to show up for random fields. some still don't show it but I can't make heads or tails of why they are not and the others are.
  • Chaoste
    Chaoste over 3 years
    Running on "86.0.4240.111 (Official Build) (x86_64)" and tried all the above mentioned approaches but nothing worked for me: hidden password field, "chrome-off"/ "off"/ "no"/ any other value for all inputs and the overall form. Very critical for a page if the autofill window actually breaks the hovering logic of the login widget and thus disappears. I'm really angry that the Chrome developers making us a difficult time with this...
  • Igor Bukin
    Igor Bukin over 3 years
    Hm, Version 86.0.4240.111 (Official Build) (64-bit) on Ubuntu correctly behaviors only with autocomplete="off". Neither "chrome-off" nor "new-password" didn't help
  • sandstrom
    sandstrom over 3 years
    Here are two Chrome issues you can comment on if you want them to change this behavior: bugs.chromium.org/p/chromium/issues/detail?id=587466 and bugs.chromium.org/p/chromium/issues/detail?id=914451
  • Gokhan Kurt
    Gokhan Kurt over 3 years
    People are misunderstanding something. off, chrome-off, whatever are all just strings. They don't have special meaning in this context. I think autocomplete attribute acts like the name field, but for autocomplete. Google just saves your previous form submit with this autocomplete string.
  • Shadoweb
    Shadoweb over 3 years
    For people using the fake hidden field remembrer to to add a tabindex="-1" to avoid the tab disappearing.
  • Corey
    Corey over 3 years
    None of the answers work for me. What in the world disables Chrome autofill?
  • Davide C
    Davide C over 3 years
    autocomplete="chrome-off" is working on my chrome on last osx. We need a consistent solution from google..
  • Rich Andrews
    Rich Andrews over 3 years
    My experience involved erroneous autofilling on a lone <input> element, which is valid. When that input element was provided a parent <form> then Chrome 87 stopped erroneously autofilling an input element that clearly had nothing to do with the autofill chrome was using.
  • sam
    sam over 3 years
    This worked for me but only tested on Chrome.
  • rickvian
    rickvian over 3 years
    i tried autocomplete="off" alone doesnt work, after adding role="presentation" along that, makes it work
  • wsyq1n
    wsyq1n about 3 years
    This does not address the issue being discussed. It is about how to STOP Chrome from autofilling. Not "how to create forms properly." Either that or your TLDR doesn't fully following through on what you're addressing or the outcomes.
  • Muhammad Rosyid
    Muhammad Rosyid about 3 years
  • Rei Miyasaka
    Rei Miyasaka about 3 years
    Not working on latest Brave or Edge on Windows. Only thing that works is autocomplete="<anything other than off|on or other valid value>" on every affected field.
  • Ruben
    Ruben about 3 years
    Thanks! But what a load of crap man. autocomplete="off" works for me now in chrome 88, but only for regular inputs. I did not test it on password fields.
  • Gavin
    Gavin about 3 years
    I'm trying in Chrome 89.0.4389.90 on macOS and it's not working :/
  • Latchy
    Latchy about 3 years
    So on Win 10 Chrome 89 my only solace came from prepending the autocomplete property with "new-", eg. <input autocomplete="new-email"/>
  • Oleg Abrazhaev
    Oleg Abrazhaev about 3 years
    this is the only working thing in chrome 88 at Mac at the moment.
  • Jaden Baptista
    Jaden Baptista about 3 years
    This isn't working in my newest version of Chrome now.
  • tmarois
    tmarois about 3 years
    As of 2021: this has worked for me, autocomplete="chrome-off"
  • Thameem
    Thameem about 3 years
    2018th solution works in 2020 for me.. Thanks for such a long answer!!
  • Appoodeh
    Appoodeh almost 3 years
    I prefer to use this instead: <input type="text" onfocus="this.setAttribute('type', 'password');"/>
  • Gopal Mishra
    Gopal Mishra almost 3 years
    This worked for me: Setting <form autocomplete="chrome-off"> <input id="password" style="position: fixed;top:-100px;left:-100px; width:5px;" type="password" name="password"> <input type="password" autocomplete="not-at-all" id="actualPassword"/> </form>
  • Artyom Krasnyuk
    Artyom Krasnyuk almost 3 years
    Who is looking how to hide built-in browser styling for the input type search: (SCSS): input[type='search'] { /* clears the 'X' from Internet Explorer / &::-ms-clear, &::-ms-reveal { display: none; width: 0; height: 0; } / clears the 'X' from Chrome */ &::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration { display: none; } }
  • demoncodemonkey
    demoncodemonkey almost 3 years
    None of these work for me, I give up. Congratulations Chrome you win.
  • Dorian
    Dorian almost 3 years
    in some cases none works and in some cases off works :shrug:
  • mediaguru
    mediaguru almost 3 years
    This works, BUT now the cursor styling shows as not allowed.
  • Rahul Sonone
    Rahul Sonone almost 3 years
    autocomplete="none" this worked for me autocomplete="off" is not working.
  • Girish Sasidharan
    Girish Sasidharan almost 3 years
    instead of autocomplete="off" set autocomplete="new-password" for all <input> you want to stop auto-filling
  • Joe Solano
    Joe Solano almost 3 years
    In Chrome 91 on Windows I have not been able to get Chrome to stop auto filling, Neither autocomplete="off" nor autocomplete="chrome-off" worked
  • row
    row almost 3 years
  • Alex Stephens
    Alex Stephens almost 3 years
    As simple as putting your input into a form.
  • Bruno Schäpper
    Bruno Schäpper almost 3 years
    This is a good solution, if you don't mind Javascript. I found Chrome still adds a password after clicking around the page a bit, so i re-enabled the field in an onmouseover event listener.
  • manuel-84
    manuel-84 almost 3 years
    as said in this comment (stackoverflow.com/questions/15738259/…) adding role="presentation" to the input fields makes autocomplet="off" works also for address autofills
  • dimitar
    dimitar almost 3 years
    This one works for me too. All other options "off", "false", etc. not working
  • Fabiano Taioli
    Fabiano Taioli over 2 years
    Version 93.0.4577.82 chrome-off not working anymore
  • CodeConnoisseur
    CodeConnoisseur over 2 years
    None of the autocomplete options from above work on Version 96.0.4664.45 (Official Build) (64-bit)
  • simon
    simon over 2 years
    Thank you, only solution working for Chrome 96 (December 2021).
  • Andrew
    Andrew over 2 years
    Still broken Version 96.0.4664.110 (Official Build) (64-bit)
  • ÄR Âmmãř Żąîñh
    ÄR Âmmãř Żąîñh over 2 years
    The legend answer thank you maaaaaaaaan
  • Jaxx0rr
    Jaxx0rr over 2 years
    autocomplete="chrome-off" works for me only if one of the input text elements has it.. if all have it it stops working
  • ryan
    ryan over 2 years
    I have been setting autocomplete="<random 12 character string>"... obviously not an ideal solution, but its the only way i've been able to consistently turn it off
  • jaypat32
    jaypat32 over 2 years
    Your update from Sept 2020 did not work for me. Using just "off" worked for me. I'm on Version 97.0.4692.71 (Official Build) (64-bit) of Chrome.
  • mikael1000
    mikael1000 over 2 years
    @Appoodeh This don't work in my Chrome password field. Well i don't get the autocomplete, but it stays as a text input (no dots) and I also have to use the autocomp.. off.
  • phunder
    phunder about 2 years
    Feb 2022 - None of the suggestions works, even using hidden inputs. I managed to get it working by adding normal inputs and hiding them with height: 0; opacity: 0; margin: 0; padding: 0; (display: none did not work either) Chrome version 98.0.4758.102
  • Furkan
    Furkan about 2 years
    I found this one. It disables on chrome, edge and opera <form autocomplete="off"> <input role="presentation" /> </form>
  • Lakatos Gyula
    Lakatos Gyula about 2 years
    The Chrome team deserves a big middle finger in their face tbh. Sometimes you just want to disable the autocomplete because it makes no sense (business logic wise, etc).
  • Vincent
    Vincent almost 2 years
    Using autocomplete='whateverrandomvalueyouwant', in other words, using an unrecognized value, is automatically converted to autocomplete='new-password' by chromium and this is apparently now honoured by chrome but not edge.
  • Vavaste
    Vavaste almost 2 years
    If you have an input type="password" with chrome Version 103.0.5060.53 (Official Build) (x86_64) The only solution to deny the autofill seems to change the type to "text", give an id/name that is not recognizable as a pwd by chrome, set autocomplete="false" and use css to recreate the "password dots" <input className="textareaProfile centerElement placeholderBlack fakePwd" type="text" id="id2" placeholder='Nuova password' autoComplete="false"/> .fakePwd{ -webkit-text-security: disc; }
  • Nuno Ribeiro
    Nuno Ribeiro almost 2 years
    revolve my problem with autocomplete="pineapple" ahah!! The dumbest workaround of my life :D Thx a lot! :D