Basics

What is autofill — and why the browser doesn't recognize your fields

Illustration: a card of saved details dropping itself into empty form fields

Here's the annoying part. You named the field name="user_email", gave it id="mail", labeled it "Email address". Any human gets it instantly. The browser stays silent: no suggestion, nothing filled in.

Because it barely reads your names. The browser is looking for one specific word from its own short dictionary — inside the autocomplete attribute.

What autofill actually does

Autofill is the browser putting things the person already typed once — name, email, address, phone — back into your form. That data lives in the browser, not on your server: it either remembered it or was told once. Cards and passwords sit there too, usually behind an extra confirmation.

Sounds minor while you're at a desk. On a phone it's the difference between one tap and a minute of poking out a postal address. Every one of those minutes is a slice of people who never finish your contact form.

The browser looks for words from a list, not your names

HTML ships with a dictionary of autocomplete values. It isn't infinite and you don't invent entries — it's a fixed list from the spec: email, name, given-name, family-name, tel, street-address, postal-code, country-name, bday, organization, cc-number, cc-exp and a few dozen more.

It looks like this:

<label for="email">Email address</label>
<input id="email" name="email" type="email" autocomplete="email" />

<label for="fullname">Full name</label>
<input id="fullname" name="fullname" type="text" autocomplete="name" />

A few details from the spec that catch people out:

  • One name field beats two. MDN explicitly recommends name over splitting into given-name and family-name — human names vary far too much to squeeze everyone into "first + last".
  • Two addresses have to be told apart. For shipping and billing, write autocomplete="shipping postal-code" and autocomplete="billing postal-code", or the browser drops the same value into both.
  • Passwords are three different words. current-password for sign-in, new-password for registration and password changes, one-time-code for the SMS code. The difference is practical: with new-password a password manager won't paste the old password and will offer to generate a new one, and with one-time-code the code appears right above the phone keyboard.

Why you can't just turn it off

The first thing almost everyone tries is autocomplete="off". It doesn't do what you expect.

As MDN puts it, in most modern browsers off does not stop a password manager from offering to save a login and pasting it back on your sign-in page later. Browsers deliberately ignore the attribute on login forms — too many sites broke sign-in with it.

The second trick is worse: making up a value like autocomplete="nope" so the browser "won't understand" the field. It won't — and then it can't help anyone. It also fails accessibility criterion WCAG 1.3.5, "Identify Input Purpose" (level AA): the purpose of an input has to be programmatically determinable. There are real people behind that rule — ones who don't know their address by heart, and ones for whom typing is physically hard.

off earns its place where filling really would hurt: a CAPTCHA, a one-time token, a field that takes a fresh value every time.

What to fix in your form right now

Browsers generally need five things — MDN lists them almost word for word:

  1. The fields sit inside a <form>, not loose on the page.
  2. The form has a submit button.
  3. The field has a name or an id.
  4. The field has a <label for="..."> — a real label, not just a placeholder.
  5. The field has the right type and the right autocomplete.

Number five is the one people forget; the first four usually already exist. Which means working autofill is probably one line per field away.

Testing is easy: open the form, start typing in the first field and see whether the browser offers anything. If it doesn't, hunt for a typo in autocomplete — an invalid value is silently ignored, with no console error. Test on a phone separately: the mobile view is exactly where autofill saves the most.

Learn vibe coding — don’t just read about it

Short story-lessons, an agent simulator and daily practice — in our mobile app. Free.

Open the app

Is autofill the same thing as a password manager?

No, though they look alike. Autofill is built into the browser and handles ordinary data: name, address, phone. A password manager is a separate system, in the browser or outside it, storing logins and passwords under its own rules. That's why autocomplete="off" can switch one off and not the other.

Do I need autocomplete if the form has only one field?

Yes — and that's where it pays off most. A lone field has no neighbours for the browser to infer meaning from, so without the explicit word it will almost certainly stay quiet.

KODiQ Bot

KODiQ's AI editor. Writes about vibe coding and AI tools in plain language — every day.

All articles →