Skip to content

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)
  1. The small things that make shoppers quit a mobile checkout
  2. autocomplete: the right token for every checkout field
  3. type and inputmode: the right keyboard on a phone
  4. What applies to your own forms (Shopify's checkout is Shopify's)
  5. How to test it on a real phone
  6. Common mistakes
  7. Frequently asked questions
  8. 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.
the same ZIP code field, two keyboards<input name="zip">02134the letter keyboard opensthe shopper switches to digits<input inputmode="numeric">021341234567890the number pad opensdigits only, large keysone attribute changes the keyboardinputmode="numeric" asks for the number pad; type="number" is for quantities

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:

FieldautocompleteNote
Full namenameMDN prefers it to splitting the name: it avoids dealing with how varied names are
First / last namegiven-name / family-nameOnly if you really need two fields
EmailemailWith type="email"
PhonetelThe full number, country code included
Phone without country codetel-nationalWhen the field shows the +1 separately
CompanyorganizationHandy on wholesale forms
Street addressaddress-line1First line of the address
Apt, suite, unitaddress-line2Second line of the address
Whole address in one fieldstreet-address<textarea> only; do not mix it with the lines
Cityaddress-level2Second administrative level: city or town
Stateaddress-level1First administrative level
ZIP codepostal-codeWith inputmode="numeric"
CountrycountryTwo-letter ISO 3166-1 code, such as US
Name on cardcc-nameOnly if the payment fields are yours
Card numbercc-numberWith inputmode="numeric"
Expirycc-expMM/YY or MM/YYYY
Security codecc-cscWith inputmode="numeric"
SMS codeone-time-codeWith inputmode="numeric"

Three rules change the outcome:

  • shipping and billing. Put in front of the token, they separate the shipping address from the billing one: autocomplete="shipping postal-code" and autocomplete="billing postal-code" are two different fields to the browser.
  • street-address or the lines, never both. MDN says address-line1, address-line2 and address-line3 should only be present when street-address is not. The spec puts street-address in the multiline group, so it belongs on a <textarea>, not an <input>.
  • off is 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.
attributes per field, a US address (illustrative)fieldtypeinputmodeautocompleteFull nametext—shipping nameEmailemail—emailPhonetel—telStreet addresstext—shipping address-line1Apt, suite, unittext—shipping address-line2Citytext—shipping address-level2Statetext—shipping address-level1ZIP codetextnumericshipping postal-codeCountryselect—shipping countryone standard token per fieldaddress-line2 is the second street line: apartment, suite or unit

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 recommends type="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>
  1. <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.
  2. id, name and <label for>: every field has a visible label and a name, which MDN also lists as a possible autofill requirement.
  3. shipping name: the recipient's name, in one field.
  4. type="email" with email: the email keyboard and format validation.
  5. type="tel" with tel: the phone keypad and the full number. No pattern, so the +1 and spaces autofill inserts are not rejected.
  6. address-line1 and address-line2: street on the first line, apartment or suite on the second, which stays optional.
  7. address-level2 and address-level1: city and state.
  8. inputmode="numeric", pattern="[0-9]{5}" and maxlength="5" on the ZIP code: the number pad, five digits, and the leading zero survives because the value is text.
  9. shipping country on a <select>: the value is the two-letter code, US.
  10. 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.

a shipping form, annotatedEmailann@example.comtype="email"keyboard with @; checks the formatPhone+1 555 010 0199type="tel"phone keypad, no format checkStreet address123 Main Stautocomplete="shipping address-line1"autofills the saved addressZIP code02134inputmode="numeric"5-digit pattern; keeps the leading 0Continue to paymentevery field says what it expectsthe phone picks the keyboard and autofill from that, with no JavaScript

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.type and el.inputMode show what the browser understood, not what you think you typed.
  • el.autocomplete returns the token when the browser recognizes it. In Chromium, a made-up token such as zip returns 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:

  1. Save an address and a phone number in the phone's browser (Chrome's or Safari's autofill settings).
  2. Open the form from a test URL, not from production.
  3. Tap each field and look at the keyboard: @ on the email, the phone keypad on the phone, digits on the ZIP code.
  4. Tap the first address field and pick the saved suggestion: street, city, state, ZIP code and country should all fill in at once.
  5. Submit and check on your server that the ZIP code arrived with all five digits.
  6. 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. Use postal-code.
  • type="number" on a ZIP code or card number. An arrow key changes the value (MDN warns about accidental increments), maxlength and pattern are ignored, and the role is spinbutton.
  • 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-address with address-line1. Pick one.
  • A strict phone pattern. Autofill may bring a +1 and spaces. Normalize the number on the server.
  • Fields with no <form>, no name or 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 autocomplete token.
  • Shipping and billing addresses use shipping and billing.
  • Email is type="email" and phone is type="tel".
  • ZIP code, card and SMS codes use inputmode="numeric", never type="number".
  • Fields sit inside a <form> with a submit button, each with a name and 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

Luis Morales

Luis Morales

Frontend and Shopify developer, EcomLabs

@luismoralesdev on Instagram

Published October 30, 2026 · updated November 1, 2026

← Blog