This question already has an answer here:

I've created a web application which uses a tagbox drop down. This works great in all browsers except Chrome browser (Version 21.0.1180.89).

Despite both the input fields AND the form field having the autocomplete="off" attribute, Chrome insists on showing a drop down history of previous entries for the field, which is obliterating the tagbox list.

marked as duplicate by Martijn Pieters Feb 7 at 3:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Technically this question was asked about 5 months before the one referenced as "This question already has an answer here". That one is the duplicate as it came after this one. – user3071434 Feb 25 at 18:19

45 Answers 45


to anyone looking for a solution to this, I finally figure it out.

Chrome only obey's the autocomplete="off" if the page is a HTML5 page (I was using XHTML).

I converted my page to HTML5 and the problem went away (facepalm).

  • 6
    My page is HTML5 and autocomplete="off" on an <input> element wasn't working. I had to turn off autocomplete for the entire form (<form autocomplete="off">) to finally get Chrome to stop autocompleting, since I'd rather not use a JavaScript solution. – Gavin Aug 15 '13 at 1:05
  • 32
    I've html5 page and it still ignores autocomplete="off" on both fields and form. – Ashit Vora Jun 25 '14 at 11:48

It appears that Chrome now ignores autocomplete="off" unless it is on the <form autocomplete="off"> tag.

  • For React use 'autoComplete=off.' – zero_cool Mar 31 '16 at 19:10
  • For an explanation of why Chrome made this change, see this answer: stackoverflow.com/a/39689037/1766230 -- They prioritize users over developers. – Luke Sep 25 '16 at 16:18
  • 5
    If you would like to provide the Chrome team with valid reasons for using autocomplete="off" please do so here: bugs.chromium.org/p/chromium/issues/detail?id=587466 – Chris Oct 16 '16 at 13:33
  • 8
    Chrome version 71 ignores all autocomplete attributes on form and input. – Digggid Dec 30 '18 at 20:46
  • @Digggid Chrome 71 doesn't ignore the attribute, but in some cases it ignores the "off" value. Using a value like "country" still works for me. – Burak Jan 10 at 9:50

i found this solution to be the most appropriate:

function clearChromeAutocomplete()
// not possible, let's try: 
if (navigator.userAgent.toLowerCase().indexOf('chrome') >= 0) 
document.getElementById('adminForm').setAttribute('autocomplete', 'off'); 
setTimeout(function () {
        document.getElementById('adminForm').setAttribute('autocomplete', 'on'); 
}, 1500);

It must be loaded after dom ready, or after the form renders.



It seems now Chrome ignores the style="display: none;" or style="visibility: hidden; attributes.

You can change it to something like:

<input style="opacity: 0;position: absolute;">
<input type="password" style="opacity: 0;position: absolute;">

In my experience, Chrome only autocompletes the first <input type="password"> and the previous <input>. So I've added:

<input style="display:none">
<input type="password" style="display:none">

To the top of the <form> and the case was resolved.

  • 5
    Here, at version 34, chrome is autocompleting more than one input in the page :( – Renato Lochetti Apr 22 '14 at 15:28
  • 44
    this not work anymore chrome 40 not work this solution – user881703 Feb 5 '15 at 4:28
  • 1
    Not only is this ugly, but I still can't find any explanation to the Why question?? – Augustin Riedinger Jun 8 '15 at 9:34
  • 4
    It seems Chrome now ignores them if display: none is used, so I moved the fields out of the view with absolute positioning... – Christoph Leiter Mar 18 '16 at 12:41
  • 1
    @ChristophLeiter, confirm this works. See stackoverflow.com/questions/12374442/… – yivo May 7 '16 at 13:59

Chrome version 34 now ignores the autocomplete=off, see this.

Lots of discussion on whether this is a good thing or a bad thing? Whats your views?

  • 1
    sorry for the downvote ... this is not a discussion site (try quora instead), and you don't provide an answer. Thanks for the link though. – commonpike Mar 11 at 19:36

After the chrome v. 34, setting autocomplete="off" at <form> tag doesn`t work

I made the changes to avoid this annoying behavior:

  1. Remove the name and the id of the password input
  2. Put a class in the input (ex.: passwordInput )

(So far, Chrome wont put the saved password on the input, but the form is now broken)

Finally, to make the form work, put this code to run when the user click the submit button, or whenever you want to trigger the form submittion:

var sI = $(".passwordInput")[0];
$(sI).attr("id", "password");
$(sI).attr("name", "password");

In my case, I used to hav id="password" name="password" in the password input, so I put them back before trigger the submition.

  • Yes, and this google's decision is really strange - theregister.co.uk/2014/04/09/… – cryss May 5 '14 at 9:33
  • This works, but it's no fun trying to do this when you've got a self-registration form with 20-odd fields on it, all of which need to be autocomplete="off". – Jonathon Cowley-Thom Oct 12 '15 at 10:14

Seen chrome ignore the autocomplete="off", I solve it with a stupid way which is using "fake input" to cheat chrome to fill it up instead of filling the "real" one.


<input type="text" name="username" style="display:none" value="fake input" /> 
<input type="text" name="username" value="real input"/>

Chrome will fill up the "fake input", and when submit, server will take the "real input" value.


TL;DR: Tell Chrome that this is a new password input and it won't provide old ones as autocomplete suggestions:

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

autocomplete="off" doesn't work due to a design decision - lots of research shows that users have much longer and harder to hack passwords if they can store them in a browser or password manager.

The specification for autocomplete has changed, and now supports various values to make login forms easy to auto complete:

<!-- Auto fills with the username for the site, even though it's email format -->
<input type="email" name="email" autocomplete="username">

<!-- current-password will populate for the matched username input  -->
<input type="password" autocomplete="current-password" />

If you don't provide these Chrome still tries to guess, and when it does it ignores autocomplete="off".

The solution is that autocomplete values also exist for password reset forms:

<label>Enter your old password:
    <input type="password" autocomplete="current-password" name="pass-old" />
<label>Enter your new password:
    <input type="password" autocomplete="new-password" name="pass-new" />
<label>Please repeat it to be sure:
    <input type="password" autocomplete="new-password" name="pass-repeat" />

You can use this autocomplete="new-password" flag to tell Chrome not to guess the password, even if it has one stored for this site.

Chrome can also manage passwords for sites directly using the credentials API, which is a standard and will probably have universal support eventually.

  • 4
    Not a really compelling reason. The fact that the user wants something doesn't mean it is a smart idea. That's almost as bad as saying you will allow single character passwords in your application because the user finds it more convenient. At times, security trumps convenience... – Daniel Kotin Jul 22 '14 at 13:28
  • @Infinitesimus - good point, but with password complexity you're protecting the user from someone cracking the password, i.e. something out of their control. Here the hacking risk is that they could leave their machine unlocked and someone use autocompete to log in as them or something similar. That's something very much in control of the user, and whether they're trusted to autofill forms should be up to the administrator of the machine, not each individual application. Personally I hate sites that won't cache my form inputs, but if I was administrator I'd turn autofill off for my users. – Keith Jul 22 '14 at 15:27
  • I have a field called "ContactNoAlt" that Chrome insists on filling with an EmailAddress. Autocomplete on/off is preferred but a work-around is needed on a practical level because Chrome is falible. More pointedly autocomplete="off" is a standard - so what makes the developers of Chrome so good that they just feel they can ignore standards - perhaps one day Chrome will decide some other piece of HTML is inconvenient .... (this is starting to feel like IE5/6 de-ja-vu) – dunxz Aug 3 '14 at 21:38
  • I'm a chrome user, and I don't want this behaviour. It didn't even ask me before it autofilled the password box that was popping up to make sure only I could access the web application concerned. Saving some passwords shouldn't mean autocompleting all passwords. – Hippyjim Mar 3 '15 at 10:15
  • 1
    This answer (and Googles behaviour) ignore the fact that one of the major reasons you might want to do this is to implement your own (e.g, list from database) autocompletion behaviours. – squarelogic.hayden Aug 13 '15 at 14:30

Whilst I agree autocomplete should be a user choice, there are times when Chrome is over-zealous with it (other browsers may be too). For instance, a password field with a different name is still auto-filled with a saved password and the previous field populated with the username. This particularly sucks when the form is a user management form for a web app and you don't want autofill to populate it with your own credentials.

Chrome completely ignores autocomplete="off" now. Whilst the JS hacks may well work, I found a simple way which works at the time of writing:

Set the value of the password field to the control character 8 ("\x08" in PHP or &#8; in HTML). This stops Chrome auto-filling the field because it has a value, but no actual value is entered because this is the backspace character.

Yes this is still a hack, but it works for me. YMMV.

  • Care to explain the down vote? The accepted answer doesn't even work and is also a kludge, which I accept mine is too. At least mine works and does actually answer the question. – spikyjt Nov 24 '14 at 14:40
  • Doesn't seem to work in Chrome 40 – hood Jan 28 '15 at 5:14
  • Prefilled values seem to be getting overwritten now :( – Hippyjim Mar 3 '15 at 10:12
  • I think they've picked up this hack and ignored control characters in the value, so it now evaluates to empty. See the answer by @ice-cream stackoverflow.com/a/16130452/752696 for the correct, up-to-date solution. – spikyjt Mar 5 '15 at 11:44
  • Same use case here: Working with user management and having own credentials autofilled. However since it's my own code and I reuse the form for creating new and editing existing users simply overriding input values via JS removed the auto-complete. – nuala Apr 5 '15 at 12:21

I solved in another way. You can try this.

<input id="passfld" type="text" autocomplete="off" />
<script type="text/javascript">
// Using jQuery

// or in pure javascript
        document.getElementById('passfld').type = 'password';

Browser does not care about autocomplete=off auto or even fills credentials to wrong text field?

I fixed it by setting the password field to read-only and activate it, when user clicks into it or uses tab-key to this field.

fix browser autofill in: readonly and set writeble on focus (at mouse click and tabbing through fields)

 <input type="password" readonly  

Update: Mobile Safari sets cursor in the field, but does not show virtual keyboard. New Fix works like before but handles virtual keyboard:

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

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

// UpdateEnd

By the way, more information on my observation:

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, sometimes even autocomplete=off would not prevent to fill in credentials into wrong fields, but not user or nickname field.

  • 2
    rather than using onfocus, I use a setTimeout to clear the readonly, so my users don't see the input is read only and never focus it! – Hippyjim Mar 3 '15 at 10:10
  • 1
    This works in Chrome v44.0.2403.125 m – OutstandingBill Aug 11 '15 at 3:26
  • IMO Chrome is being WAY too helpful in autocomplete. I mean, ignoring autocomplete='off', wtf?! Thankfully, your solution worked. Still, WTF! Why wouldn't they trust the developer. If their form isn't auto-completed, it should be on the developer, not the browser to fix it. – Funkodebat Dec 6 '16 at 18:53

I've came up with the following solution that queries all fields with the attribute autocomple="off" then set it's value to a single space then set a timer for around 200ms and set the value back to an empty string.


// hack to prevent auto fill on chrome
var noFill = document.querySelectorAll("input[autocomplete=off]");

noFill.forEach(function(el) {
    el.setAttribute("value", " ");
    setTimeout(function() {
        el.setAttribute("value", "");
    }, 200);

I choose 200ms for the timer because after some experimentation 200ms seems to be the amount of time it takes on my computer for chrome to give up on trying to autocomplete the fields. I'm welcome to hear what other times seem to work better for other people.

  • The timing varies too much for me for this to be useful - I've tried similar and it varies on the same page in the same browser. – Hippyjim Mar 3 '15 at 9:36
  • This prevents any server-side preset value... – Daniel Bleisteiner Aug 1 '16 at 11:33

The solution at present is to use type="search". Google doesn't apply autofill to inputs with a type of search.

See: https://twitter.com/Paul_Kinlan/status/596613148985171968

Update 04/04/2016: Looks like this is fixed! See http://codereview.chromium.org/1473733008

  • this is not true as v73 – Miguel Mar 27 at 17:14

As of Chrome 42, none of the solutions/hacks in this thread (as of 2015-05-21T12:50:23+00:00) work for disabling autocomplete for an individual field or the entire form.

EDIT: I've found that you actually only need to insert one dummy email field into your form (you can hide it with display: none) before the other fields to prevent autocompleting. I presume that chrome stores some sort of form signature with each autocompleted field and including another email field corrupts this signature and prevents autocompleting.

<form action="/login" method="post">
    <input type="email" name="fake_email" style="display:none" aria-hidden="true">
    <input type="email" name="email">
    <input type="password" name="password">
    <input type="submit">

The good news is that since the "form signature" is corrupted by this, none of the fields are autocompleted, so no JS is needed to clear the fake fields before submission.

Old Answer:

The only thing I've found to be still viable is to insert two dummy fields of type email and password before the real fields. You can set them to display: none to hide them away (it isn't smart enough to ignore those fields):

<form action="/login" method="post">
    <input type="email" name="fake_email" style="display:none" aria-hidden="true">
    <input type="password" name="fake_password" style="display:none" aria-hidden="true">
    <input type="email" name="email">
    <input type="password" name="password">
    <input type="submit">

Unfortunately, the fields must be within your form (otherwise both sets of inputs are autofilled). So, for the fake fields to be truly ignored you'll need some JS to run on form submit to clear them:

form.addEventListener('submit', function() {
    form.elements['fake_email'].value = '';
    form.elements['fake_password'].value = '';

Notice from above that clearing the value with Javascript works to override the autocomplete. So if loosing the proper behavior with JS disabled is acceptable, you can simplify all of this with a JS autocomplete "polyfill" for Chrome:

(function(document) {

    function polyfillAutocomplete(nodes) {

        for(var i = 0, length = nodes.length; i < length; i++) {

            if(nodes[i].getAttribute('autocomplete') === 'off') {

                nodes[i].value = '';

    setTimeout(function() {


    }, 1);

  • All of these solutions require a form tag; but what if your form tag is part of your masterpage? – Jonathon Cowley-Thom Oct 12 '15 at 10:09
  • I don't know what you mean by masterpage, but regardless of the scope of the form, you should be able to disable autocomplete by including a dummy email before your real email field. – Bailey Parker Oct 18 '15 at 21:38

For a reliable workaround, you can add this code to your layout page:

<div style="display: none;">
 <input type="text" id="PreventChromeAutocomplete" 
  name="PreventChromeAutocomplete" autocomplete="address-level4" />

Chrome respects autocomplete=off only when there is at least one other input element in the form with any other autocomplete value.

This will not work with password fields--those are handled very differently in Chrome. See https://code.google.com/p/chromium/issues/detail?id=468153 for more details.

UPDATE: Bug closed as "Won't Fix" by Chromium Team March 11, 2016. See last comment in my originally filed bug report, for full explanation. TL;DR: use semantic autocomplete attributes such as autocomplete="new-street-address" to avoid Chrome performing autofill.


The hidden input element trick still appears to work (Chrome 43) to prevent autofill, but one thing to keep in mind is that Chrome will attempt to autofill based on the placeholder tag. You need to match the hidden input element's placeholder to that of the input you're trying to disable.

In my case, I had a field with a placeholder text of 'City or Zip' which I was using with Google Place Autocomplete. It appeared that it was attempting to autofill as if it were part of an address form. The trick didn't work until I put the same placeholder on the hidden element as on the real input:

<input style="display:none;" type="text" placeholder="City or Zip" />
<input autocomplete="off" type="text" placeholder="City or Zip" />

Modern Approach

Simply make your input readonly, and on focus, remove it. This is a very simple approach and browsers will not populate readonly inputs. Therefore, this method is accepted and will never be overwritten by future browser updates.

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

The next part is optional. Style your input accordingly so that it does not look like a readonly input.

input[readonly] {
     cursor: text;
     background-color: #fff;


  • 27
    @Basit - And that's why I called it a modern approach. Less than 1% of users in the world have Javascript turned off. So honestly, it's not worth anyones time accommodating for such a small audience when a large majority of websites rely on Javascript. Been developing websites for a very long time now, and 100% of my sites use Javascript and rely on it heavily. If users have Javascript turned off, that's their own problem and choice, not mine. They'll be unable to visit or use at least 90% of websites online with it turned off... Your downvote is completely irrelevant. – Fizzix Nov 4 '15 at 0:11
  • 9
    This does not work today in 49. Chrome "developers" is watching stackoverflow solutions and removing them. – puchu Apr 14 '16 at 13:55
  • @puchu - I'm using Chrome 49 and it's working perfectly fine? Use the following example, enter in a username and password, click 'Submit', save them to your Chrome saved credentials, reload the page, and you will notice that they are not auto filled - jsfiddle.net/w0wxy9ao/18 – Fizzix Apr 18 '16 at 1:00
  • 6
    This answer from September 2015 is basically a copy from the answer in November 2014 down below. – dsuess Dec 14 '16 at 11:01

I had a similar issue where the input field took either a name or an email. I set autocomplete="off" but Chrome still forced suggestions. Turns out it was because the placeholder text had the words "name" and "email" in it.

For example

<input type="text" placeholder="name or email" autocomplete="off" />

I got around it by putting a zero width space into the words in the placeholder. No more Chrome autocomplete.

<input type="text" placeholder="nam&#8203;e or emai&#8203;l" autocomplete="off" />

After having tried all solutions, Here is what seems to be working for chrome version:45, with form having password field :

        //For disabling Chrome Autocomplete
        jQuery( ":text" ).attr('autocomplete','pre'+Math.random(0,100000000));
  • 1
    what does 'pre'+Math.random(0,100000000) do? Can you please give more detail on your answer. – Serge Eremeev Jun 20 '16 at 9:58

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

from: https://stackoverflow.com/a/29582380/75799

  • 1
    Actually not working in Chrome 65 – Guilherme IA Mar 15 '18 at 21:55

Change input type attribute to type="search".

Google doesn't apply auto-fill to inputs with a type of search.

  • I am not down voting this solution but need to mention that I have just tried using search as type and it still gets auto-completed... – eYe Mar 31 '16 at 14:53
  • @eYe Hmm, could be they patched this one up too. Thanks for letting me know. – Matas Vaitkevicius Mar 31 '16 at 14:59
  • I'll downvote: tested on chrome 60: this doesn't prevent autocomplete.. – boly38 Sep 21 '17 at 10:10
  • It works on Chrome V64.0.3282.167 – Jaggana Feb 27 '18 at 12:39

To prevent autocomplete, just set an empty space as the input value:

<input type="text" name="name" value="  ">
  • 1
    This makes no sense... Most of the times you want to use the value attribute and it will only not show autocomplets because nothing starts with a space. – Roel Dec 31 '15 at 13:38
  • Can you clarify? Autocomplete is only triggered on empty inputs, what I say is that to prevent it you can render white spaces instead of empty string. – JVitela Jan 27 '16 at 16:56
  • no, autocomplete triggering on inputs that has a similar starting characters – Yevgeniy Afanasyev Feb 7 at 3:28

Well, a little late to the party, but it seems that there is a bit of misunderstanding about how autocomplete should and shouldn't work. According to the HTML specifications, the user agent (in this case Chrome) can override autocomplete:


A user agent may allow the user to override an element's autofill field name, e.g. to change it from "off" to "on" to allow values to be remembered and prefilled despite the page author's objections, or to always "off", never remembering values. However, user agents should not allow users to trivially override the autofill field name from "off" to "on" or other values, as there are significant security implications for the user if all values are always remembered, regardless of the site's preferences.

So in the case of Chrome, the developers have essentially said "we will leave this to the user to decide in their preferences whether they want autocomplete to work or not. If you don't want it, don't enable it in your browser".

However, it appears that this is a little over-zealous on their part for my liking, but it is the way it is. The specification also discusses the potential security implications of such a move:

The "off" keyword indicates either that the control's input data is particularly sensitive (for example the activation code for a nuclear weapon); or that it is a value that will never be reused (for example a one-time-key for a bank login) and the user will therefore have to explicitly enter the data each time, instead of being able to rely on the UA to prefill the value for him; or that the document provides its own autocomplete mechanism and does not want the user agent to provide autocompletion values.

So after experiencing the same frustration as everyone else, I found a solution that works for me. It is similar in vein to the autocomplete="false" answers.

A Mozilla article speaks to exactly this problem:


In some case, the browser will keep suggesting autocompletion values even if the autocomplete attribute is set to off. This unexpected behavior can be quite puzzling for developers. The trick to really force the no-completion is to assign a random string to the attribute

So the following code should work:


And so should each of the following:


The issue I see is that the browser agent might be smart enough to learn the autocomplete attribute and apply it next time it sees the form. If it does do this, the only way I can see to still get around the problem would be to dynamically change the autocomplete attribute value when the page is generated.

One point worth mentioning is that many browser will ignore autocomplete settings for login fields (username and password). As the Mozilla article states:

For this reason, many modern browsers do not support autocomplete="off" for login fields.

  • If a site sets autocomplete="off" for a form, and the form includes username and password input fields, then the browser will still offer to remember this login, and if the user agrees, the browser will autofill those fields the next time the user visits this page.
  • If a site sets autocomplete="off" for username and password input fields, then the browser will still offer to remember this login, and if the user agrees, the browser will autofill those fields the next time the user visits this page.

This is the behavior in Firefox (since version 38), Google Chrome (since 34), and Internet Explorer (since version 11).

Finally a little info on whether the attribute belongs on the form element or the input element. The spec again has the answer:

If the autocomplete attribute is omitted, the default value corresponding to the state of the element's form owner's autocomplete attribute is used instead (either "on" or "off"). If there is no form owner, then the value "on" is used.

So. Putting it on the form should apply to all input fields. Putting it on an individual element should apply to just that element (even if there isn't one on the form). If autocomplete isn't set at all, it defaults to on.


To disable autocomplete on the whole form:

<form autocomplete="off" ...>

Or if you dynamically need to do it:

<form autocomplete="random-string" ...>

To disable autocomplete on an individual element (regardless of the form setting being present or not)

<input autocomplete="off" ...>

Or if you dynamically need to do it:

<input autocomplete="random-string" ...>

And remember that certain user agents can override even your hardest fought attempts to disable autocomplete.


Up until just this last week, the two solutions below appeared to work for Chrome, IE and Firefox. But with the release of Chrome version 48 (and still in 49), they no longer work:

  1. The following at the top of the form:
<input style="display:none" type="text" name="fakeUsername"/>
<input style="display:none" type="password" name="fakePassword"/>
  1. The following in the password input element:


So to quickly fix this, at first I tried to use a major hack of initially setting the password input element to disabled and then used a setTimeout in the document ready function to enable it again.

setTimeout(function(){$('#PasswordData').prop('disabled', false);}, 50);

But this seemed so crazy and I did some more searching and found @tibalts answer in Disabling Chrome Autofill. His answer is to use autocomplete="new-password" in the passwords input and this appears to work on all browsers (I have kept my fix number 1 above at this stage).

Here is the link in the Google Chrome developer discussion: https://code.google.com/p/chromium/issues/detail?id=370363#c7

  • autocomplete="new-password" worked on 49.0.2623.87 – Jorge Sampayo Mar 10 '16 at 17:40
  • @JorgeSampayo Only works on password inputs but not on text inputs. – eYe Mar 31 '16 at 15:52
  • autocomplete="new-password" does not seem to work in FF 50 or IE 11 – Andreas Dec 9 '16 at 12:27

I am posting this answer to bring an updated solution to this problem. I am currently using Chrome 49 and no given answer work for this one. I am also looking for a solution working with other browsers and previous versions.

Put this code on the beginning of your form

<div style="display: none;">
    <input type="text" autocomplete="new-password">
    <input type="password" autocomplete="new-password">

Then, for your real password field, use

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

Comment this answer if this is no longer working or if you get an issue with another browser or version.

Approved on:

  • Chrome : 49
  • Firefox : 44, 45
  • Edge : 25
  • Internet Explorer : 11
  • 1
    Unfortunately, Chrome version 49.0.2623.87 and it does not work for TextBox, I still see autocomplete poping up. – eYe Mar 31 '16 at 14:39

I just updated to Chrome 49 and Diogo Cid's solution doesn't work anymore.

I made a different workaround hiding and removing the fields at run-time after the page is loaded.

Chrome now ignores the original workaround applying the credentials to the first displayed type="password" field and its previous type="text" field, so I have hidden both fields using CSS visibility: hidden;

<!-- HTML -->
    <!-- Fake fields -->
    <input class="chromeHack-autocomplete">
    <input type="password" class="chromeHack-autocomplete">

    <input type="text" placeholder="e-mail" autocomplete="off" />
    <input type="password" placeholder="Password" autocomplete="off" />

<!-- CSS -->
.chromeHack-autocomplete {
    height: 0px !important;
    width: 0px !important;
    opacity: 0 !important;
    padding: 0 !important; margin: 0 !important;

<!--JavaScript (jQuery) -->
jQuery(window).load(function() {
    $(".chromeHack-autocomplete").delay(100).hide(0, function() {

I know that it may seem not very elegant but it works.


Looks like this is fixed! See https://codereview.chromium.org/1473733008


In Chrome 48+ use this solution:

  1. Put fake fields before real fields:

    <form autocomplete="off">
      <input name="fake_email"    class="visually-hidden" type="text">
      <input name="fake_password" class="visually-hidden" type="password">
      <input autocomplete="off" name="email"    type="text">
      <input autocomplete="off" name="password" type="password">
  2. Hide fake fields:

    .visually-hidden {
      margin: -1px;
      padding: 0;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip: rect(0 0 0 0);
      clip: rect(0, 0, 0, 0);
      position: absolute;
  3. You did it!

Also this will work for older versions.

  • This works for me with Chrome 52... – Daniel Bleisteiner Aug 1 '16 at 11:38
  • Anyone confirm if this is working for version 60? Tried implementing and doesn't appear to work except for incognito :( – Mike Purcell Aug 28 '17 at 18:57
  • @MikePurcell It works for me. I have OS X 10.12.4 and Chrome 60.0.3112.101. See screenshots what you actually should have: dropbox.com/s/11btbxl469hagbt/… and dropbox.com/s/73nom28iewd8z8m/… – yivo Aug 29 '17 at 9:32
  • @yivo Looks like the only diff between urs and og answer is the !important tags, so I added them, still not working. dropbox.com/s/24yaz6ut7ygkoql/… – Mike Purcell Aug 29 '17 at 13:45
  • @MikePurcell You don't have autocomplete="off" on the form tag. Also try to put fake inputs immediately after form tag. – yivo Aug 30 '17 at 8:17

Here is what worked for me on Chrome Version 51.0.2704.106.<input id="user_name" type="text" name="user_name" autocomplete="off" required /> and in combination with <input id="user_password" type="password" name="user_password" autocomplete="new-password" required />. My problem was that after implementing new-password it would still show a drop-down of usernames on the user_name field.


Prevent autocomplete of username (or email) and password:

<input type="email" name="email"><!-- Can be type="text" -->
<input type="password" name="password" autocomplete="new-password">

Prevent autocomplete a field (might not work):

<input type="text" name="field" autocomplete="nope">


autocomplete still works on an <input>despite having autocomplete="off", but you can change off to a random string, like nope.

Others "solutions" for disabling the autocomplete of a field (it's not the right way to do it, but it works):



<input type="password" id="some_id" autocomplete="new-password">

JS (onload):

(function() {
    var some_id = document.getElementById('some_id');
    some_id.type = 'text';

or using jQuery:

$(document).ready(function() {
    var some_id = $('#some_id');
    some_id.prop('type', 'text');



<form id="form"></form>

JS (onload):

(function() {
    var input = document.createElement('INPUT');
    input.type = 'text';

or using jQuery:

$(document).ready(function() {
    $('<input>', {
        type: 'text'

To add more than one field using jQuery:

function addField(label) {
  var div = $('<div>');
  var input = $('<input>', {
    type: 'text'
  if(label) {
    var label = $('<label>', {
      text: label
  } else {

$(document).ready(function() {
  addField('Field 1: ');  
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form id="form"></form>

Works in:

  • Chrome: 49+

  • Firefox: 44+

  • Theres no code, just how does your answer actually prevent autocomplete if autocomplete="" is supposed to just accept a boolean – Tallboy Jan 19 '17 at 19:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.