autocomplete attribute cheat sheet
The right autocomplete token lets a phone fill a field in one tap. It is also a WCAG 2.1 level AA requirement.
Why it matters
WCAG success criterion 1.3.5, Identify Input Purpose (level AA), asks that fields collecting information about the user identify their purpose in code. In HTML that means the standard autocomplete tokens. Browsers and password managers use the same tokens to autofill. On a phone, that is the difference between typing a full address and tapping it once.
The tokens you will use most
| Field | Token |
|---|---|
| Full name | name |
| First / last name | given-name / family-name |
email | |
| Phone | tel |
| Street address (one line) | street-address, or address-line1 and address-line2 |
| City / state | address-level2 / address-level1 |
| ZIP or postcode | postal-code |
| Country | country-name (or country for a code) |
| Username | username |
| Password on a sign-in form | current-password |
| Password on a sign-up or change form | new-password |
| Code sent by text message | one-time-code |
| Card number / expiry / security code / name on card | cc-number / cc-exp / cc-csc / cc-name |
| Birthday | bday |
| Company | organization |
Common mistakes
- autocomplete="off" on personal details. Many browsers ignore it for some fields anyway. Where they obey it, people type their own address by hand.
- Made-up values such as
autocomplete="zip". Unknown tokens are ignored; the correct one ispostal-code. - current-password on a sign-up form. Password managers then offer the old password instead of generating a new one.
- Two addresses with the same tokens. Prefix them:
shipping postal-codeandbilling postal-code.
Check it
The checker guesses each field's purpose from its name, id and label. It flags missing or unknown tokens and puts the right one in the suggested tag.
Frequently asked questions
Does autocomplete apply to search boxes?
No. 1.3.5 covers information about the user. A search box or a comment field does not need a token.
Is autocomplete="on" enough?
No. "on" lets the browser guess. A specific token such as email or postal-code is what identifies the purpose.
Found a mistake or want a check added? Write to contact (at) mobileformcheck.com.