Mobile checkout form autocomplete: the right keyboard for every field
Guide/ 11 min read
The HTML attributes that let a phone fill in the address and open the right keyboard, with the token for every field and a tested form you can copy.
- Checkout
- CRO
In this article (8)
- The small things that make shoppers quit a mobile checkout
- autocomplete: the right token for every checkout field
- type and inputmode: the right keyboard on a phone
- What applies to your own forms (Shopify's checkout is Shopify's)
- How to test it on a real phone
- Common mistakes
- Frequently asked questions
- Checklist
Mobile checkout form autocomplete is one of the cheapest fixes for shoppers who quit on a phone: every field the browser cannot fill, or that opens the wrong keyboard, is one more reason to leave. Three HTML attributes fix it: autocomplete tells the browser what goes in each field, and type and inputmode pick the keyboard.
Below you get the right autocomplete token for every checkout field, which keyboard each type and inputmode asks for, a shipping form tested in Chromium, and how to check it on a real phone. If you do not know yet which step loses people, start by getting the GA4 add_to_cart event right; and if the page itself is slow to show up, look at the hero image holding back LCP.
The small things that make shoppers quit a mobile checkout
On a laptop, a badly set up field is an annoyance. On a phone, one thumb and a small screen turn it into extra work at every step. These are the problems that keep showing up in hand-built forms:
- The phone never offers the saved address. If the field does not say what it expects, the browser has nothing to suggest, and the shopper types street, city and ZIP code by hand.
- A letter keyboard opens for a number. Typing a ZIP code means switching keyboards, then switching back.
- The email field has no @ key. A plain text input does not ask for the email keyboard.
- The ZIP code loses its leading zero. With
type="number", one arrow key is enough to change the value: in my test, "02134" became "2135" with one press of the up arrow. - Validation is stricter than real life. A phone pattern that rejects spaces or a +1 blocks the people who used autofill.
Scroll the figure sideways to see all of it
There is one more reason to get it right: per MDN, valid autocomplete tokens on fields that collect personal data also satisfy WCAG 2.2 Success Criterion 1.3.5, Identify Input Purpose (Level AA).
autocomplete: the right token for every checkout field
The autocomplete attribute takes a closed list of values defined in the WHATWG autofill specification, and the MDN autocomplete reference explains each one. These are the ones a checkout needs:
| Field | autocomplete | Note |
|---|---|---|
| Full name | name | MDN prefers it to splitting the name: it avoids dealing with how varied names are |
| First / last name | given-name / family-name | Only if you really need two fields |
email | With type="email" | |
| Phone | tel | The full number, country code included |
| Phone without country code | tel-national | When the field shows the +1 separately |
| Company | organization | Handy on wholesale forms |
| Street address | address-line1 | First line of the address |
| Apt, suite, unit | address-line2 | Second line of the address |
| Whole address in one field | street-address | <textarea> only; do not mix it with the lines |
| City | address-level2 | Second administrative level: city or town |
| State | address-level1 | First administrative level |
| ZIP code | postal-code | With inputmode="numeric" |
| Country | country | Two-letter ISO 3166-1 code, such as US |
| Name on card | cc-name | Only if the payment fields are yours |
| Card number | cc-number | With inputmode="numeric" |
| Expiry | cc-exp | MM/YY or MM/YYYY |
| Security code | cc-csc | With inputmode="numeric" |
| SMS code | one-time-code | With inputmode="numeric" |
Three rules change the outcome:
shippingandbilling. Put in front of the token, they separate the shipping address from the billing one:autocomplete="shipping postal-code"andautocomplete="billing postal-code"are two different fields to the browser.street-addressor the lines, never both. MDN saysaddress-line1,address-line2andaddress-line3should only be present whenstreet-addressis not. The spec putsstreet-addressin the multiline group, so it belongs on a<textarea>, not an<input>.offis not a fix. It asks the browser not to fill the field, but MDN notes that most modern browsers still let a password manager offer to fill a login form. On a checkout, taking autofill away from the shopper only adds work.
Scroll the figure sideways to see all of it
type and inputmode: the right keyboard on a phone
type changes what the field is and how it validates; inputmode only asks for a keyboard. The MDN inputmode page is explicit that it enforces no validation at all. This is how they split the work:
type="email"for the email. Per the MDN page, the browser checks for a well-formed address before submitting. MDN describes the email keyboard as one that typically includes the @ key, and recommendstype="email"for fields that require an email.type="tel"for the phone. It opens the phone keypad and, per the type="tel" reference, does not validate the format, because phone numbers vary so much between countries. Validate on your server.inputmode="numeric"for anything typed in digits that is not a quantity: ZIP code, card number, security code, SMS code. It asks for the 0–9 keypad.inputmode="decimal"for amounts with decimals, such as a budget on a wholesale form. It shows the digits and the locale's decimal separator.type="number"only for quantities it makes sense to step up and down, like how many units of a product.
The type="number" page says it outright: it is not appropriate for values that happen to be all digits but are not really numbers, such as postal codes or credit card numbers. Its role is spinbutton and it does not support pattern. I checked it in Chromium: with type="number", "06600" plus one up-arrow press became "6601", and the field took "066001" despite maxlength="5" and a pattern, and still counted as valid.
A complete shipping form
This is the form I tested, with a US address (illustrative):
<form action="/order" method="post">
<label for="name">Full name</label>
<input id="name" name="name" autocomplete="shipping name" required>
<label for="email">Email</label>
<input id="email" name="email" type="email" autocomplete="email" required>
<label for="phone">Phone</label>
<input id="phone" name="phone" type="tel" autocomplete="tel" required>
<label for="address1">Street address</label>
<input id="address1" name="address1" autocomplete="shipping address-line1" required>
<label for="address2">Apt, suite, unit (optional)</label>
<input id="address2" name="address2" autocomplete="shipping address-line2">
<label for="city">City</label>
<input id="city" name="city" autocomplete="shipping address-level2" required>
<label for="state">State</label>
<input id="state" name="state" autocomplete="shipping address-level1" required>
<label for="zip">ZIP code</label>
<input id="zip" name="zip" inputmode="numeric" pattern="[0-9]{5}" maxlength="5"
autocomplete="shipping postal-code" required>
<label for="country">Country</label>
<select id="country" name="country" autocomplete="shipping country">
<option value="US">United States</option>
</select>
<button type="submit">Continue to payment</button>
</form>
<form>and<button type="submit">: MDN warns that browsers may only autofill fields inside a form that has a submit button. A<div>with a JavaScript button can end up with no suggestions.id,nameand<label for>: every field has a visible label and a name, which MDN also lists as a possible autofill requirement.shipping name: the recipient's name, in one field.type="email"withemail: the email keyboard and format validation.type="tel"withtel: the phone keypad and the full number. Nopattern, so the +1 and spaces autofill inserts are not rejected.address-line1andaddress-line2: street on the first line, apartment or suite on the second, which stays optional.address-level2andaddress-level1: city and state.inputmode="numeric",pattern="[0-9]{5}"andmaxlength="5"on the ZIP code: the number pad, five digits, and the leading zero survives because the value is text.shipping countryon a<select>: the value is the two-letter code,US.required: native validation in the browser. It does not replace your server's.
In Chromium 151 with Playwright, the form gave this: nine fields with unique ids and one label each; the browser read back every autocomplete value; "2134" failed the pattern; a sixth digit did not go in; "ann@" failed the email check; and on submit the server received zip=02134, leading zero intact.
Scroll the figure sideways to see all of it
What applies to your own forms (Shopify's checkout is Shopify's)
If you sell on Shopify, the contact, shipping and payment fields of the checkout are not yours. The checkout apps documentation says checkout.liquid is no longer supported on the Information, Shipping and Payment steps; checkout is customized through extensions (UI, Functions, web pixel and payments extensions), not by editing the HTML of those fields. Shopify decides their attributes, and there is no template of yours to change them in.
Everything else is yours, and that is where these attributes tend to be missing:
- The theme's contact or quote form.
- Wholesale sign-up, with company name and delivery address.
- Forms inside your own apps, or third-party apps you configure.
- A custom or headless storefront with its own checkout.
- The SMS code prompt at sign-in.
If you take payments through your provider's hosted card fields, the provider sets those attributes; check its docs before adding your own.
How to test it on a real phone
Start with a quick check on your computer. Open the page, open the developer tools console and paste this:
console.table([...document.querySelectorAll("input, select, textarea")].map((el) => ({
field: el.name,
type: el.type,
inputmode: el.inputMode,
autocomplete: el.autocomplete || "⚠ empty or invalid",
})));
document.querySelectorAll(…)collects every field on the page.el.typeandel.inputModeshow what the browser understood, not what you think you typed.el.autocompletereturns the token when the browser recognizes it. In Chromium, a made-up token such aszipreturns an empty string, and the table flags it with ⚠. It does not catch a valid token on the wrong kind of field; the table above covers that.
Then the phone. The keyboard and autofill only show up on a real device:
- Save an address and a phone number in the phone's browser (Chrome's or Safari's autofill settings).
- Open the form from a test URL, not from production.
- Tap each field and look at the keyboard: @ on the email, the phone keypad on the phone, digits on the ZIP code.
- Tap the first address field and pick the saved suggestion: street, city, state, ZIP code and country should all fill in at once.
- Submit and check on your server that the ZIP code arrived with all five digits.
- Repeat on an iPhone with Safari and an Android phone with Chrome: each has its own keyboard and its own autofill.
Common mistakes
- Making up the value.
autocomplete="zip"or"postcode"are not tokens, and the browser ignores them. Usepostal-code. type="number"on a ZIP code or card number. An arrow key changes the value (MDN warns about accidental increments),maxlengthandpatternare ignored, and the role isspinbutton.autocomplete="off"on the whole form. It takes autofill away from the people who need it most, the ones buying on a phone.- Mixing
street-addresswithaddress-line1. Pick one. - A strict phone pattern. Autofill may bring a +1 and spaces. Normalize the number on the server.
- Fields with no
<form>, nonameor no label. The browser may not fill them, and a screen reader cannot tell what they ask for. - Testing on a computer only. The console confirms the attributes; the keyboard and autofill need a phone.
Frequently asked questions
Should I use name, or given-name and family-name?
MDN recommends a single name field, because it avoids dealing with how varied names are. Split into given-name and family-name only if your shipping or billing system really needs it.
How do I keep the shipping and billing addresses apart?
Put shipping or billing in front of the token: shipping postal-code and billing postal-code. For more groups, a section- prefix with your own name groups the fields that belong together.
When is type="number" the right choice?
For quantities it makes sense to step up and down, like units of a product in the cart. For anything that is just made of digits (ZIP code, card, SMS code), use inputmode="numeric".
Does this improve Shopify's checkout?
Not directly: Shopify controls those fields. It improves everything you do build, such as wholesale, sign-up and contact forms, or a checkout of your own. On a Shopify store, what you can do is measure which step people drop at, and that is what a correctly set up GA4 add_to_cart event is for.
Checklist
- Every personal-data field has a valid
autocompletetoken. - Shipping and billing addresses use
shippingandbilling. - Email is
type="email"and phone istype="tel". - ZIP code, card and SMS codes use
inputmode="numeric", nevertype="number". - Fields sit inside a
<form>with a submit button, each with anameand a visible label. - No
autocomplete="off"on fields the shopper should be able to autofill. - The console check shows no ⚠.
- You tested the keyboard and autofill on an iPhone and on an Android phone.
- The server validates the format even though the browser already does.
A checkout that fills in with two taps needs no extra code, only the right attributes. To see whether the change shows up, measure each funnel step with GA4's ecommerce events; to get the page onto the phone fast, look at the hero image and LCP; and to decide what to test next, read CRO on Shopify without guessing.
Saw this on Instagram? Comment CHECKOUT on the Reel and I'll send you the guide.
Written by

Published October 30, 2026 · updated November 1, 2026