On this page
What this issue is
Postcode validation is a check that a form runs on the postal code field before it lets you submit. It goes wrong when the rule does not match the country the visitor chose. Typical examples: a field that only accepts five digits rejects the UK postcode SW1A 1AA, the Canadian code K1A 0B1 and the Irish Eircode D02 X285.
The reverse also happens. A UK-only pattern blocks US ZIP codes, or a form demands a postcode in countries that do not use one, such as Ireland before Eircodes or many countries in Africa and the Middle East. Some countries also write codes in several ways: with or without a space, in upper or lower case, or with a ZIP+4 extension like 90210-1234.
Why it costs you leads or sales
The visitor has a real address and a real intent to buy or enquire, but the form tells them it is wrong. Most people do not try again with a fake code. They leave, or they stop trusting the checkout. The loss is silent: you see abandoned forms, not a rejected valid customer.
It hits hardest when you run ads or translated pages for several countries. The traffic you paid to reach a market is the traffic the form blocks. Small markets are easy to miss because the owner only ever tests with a home-country address.
- Ad click (UK)Visitor lands on the localised page
- Fills in formEnters name, email and SW1A 1AA
- Postcode checkRule expects 5 digits and rejects it
- SubmissionNever sent
- Lead or orderNever recorded
A form that only accepts 5-digit ZIP codes stops a valid UK customer at the address step.
Example: completion rate for the same form when a US-only ZIP rule is applied to every country. Numbers are illustrative.
How to check if your site has it
Test the form with real postcodes from every country you sell to or advertise in. Pick the country in the dropdown first, because many forms change the rule when the country changes. If there is no country field, test with each format anyway.
| Country | Example | Format notes |
|---|---|---|
| United States | 90210 and 90210-1234 | 5 digits, optional 4-digit extension |
| United Kingdom | SW1A 1AA, M1 1AE, EC1A 1BB | Letters and digits, 5 to 7 characters, space before the last 3 |
| Canada | K1A 0B1 | Letter, digit, letter, space, digit, letter, digit |
| Ireland | D02 X285 | Eircode: 3 characters, space, 4 characters |
| Netherlands | 1012 JS | 4 digits then 2 letters |
| Germany | 10115 | 5 digits |
| Hong Kong | (none) | No postcode; field must be optional |
- Enter each example above with the matching country selected
- Type the UK code in lower case and without the space
- Try a US ZIP+4 code
- Leave the field empty for a country with no postcodes
- Check the page source or network tab for a pattern attribute or a validation request
- Test on mobile, where autofill can insert a different format
How to fix it
There are three sound options. Pick the simplest that fits your business. For many lead forms, a loose check or no check at all loses fewer customers than a strict one. For shipping, a strict check per country is useful, but only if it is right.
Find where the rule lives
It may be a
patternattribute on the input, a JavaScript regex, a form builder setting, or a server-side check. Often it is more than one.Choose a strategy
Either (a) pick the rule from the selected country, (b) use a loose rule such as 3 to 10 letters, digits, spaces or hyphens, or (c) remove the format check and keep the field required only where you ship.
Make the field optional where no postcode exists
Do not require a postcode for countries that do not use one. Make requirement depend on the country.
Accept common variations
Allow upper and lower case, an optional space, and ZIP+4. Clean the value (trim, uppercase) after validation rather than rejecting it.
Update client and server together
If only the browser rule changes, the server may still reject the entry. Change both so they agree.
Retest every country
Use the test table above and a real order or enquiry path.
Form plugin
In Gravity Forms, Contact Form 7, WPForms or similar, open the postcode field. Remove any custom regex or pattern, or switch the field to a plain text type. In Contact Form 7, check for a custom
[text* postcode]with a validation filter in your theme.WooCommerce checkout
WooCommerce validates postcodes per country by default. If checkout rejects a valid code, look for a plugin or snippet using the
woocommerce_validate_postcodefilter, and disable it to test.
Checkout
Shopify validates addresses per country in checkout. If a valid code is rejected, check Settings > Markets and Settings > Shipping and delivery for the country, and confirm the address format. Contact support if the built-in check is wrong.
Custom forms in your theme
Search your theme files for
pattern=andziporpostcodein the form sections, and remove or loosen the pattern.
Not the cause
GTM does not validate fields unless you added a custom HTML tag that does. Check Tags for any custom script touching the postcode input and pause it to test.
Native forms
Webflow forms have no built-in postcode rule. Check the input settings and any custom code in Page settings or Site settings > Custom code for a pattern or script.
Form builder
Open the form in Sites > Forms. Use a plain text field for the postcode rather than a field with a custom validation, and set Required only when needed.
Wix Forms and Velo
In the form's input settings, turn off any restrictive validation. If you use Velo, search page code for a regex on the postcode input.
Form blocks and Commerce
Form block address fields use built-in country handling. If a custom code injection adds a pattern, remove it from Settings > Developer Tools > Code Injection.
Pick the rule by country
Use a map of patterns keyed by country code and fall back to a loose check. See the snippet below.
const POSTCODE_RULES = {
US: /^\d{5}(-\d{4})?$/,
GB: /^[A-Z]{1,2}\d[A-Z\d]? ?\d[A-Z]{2}$/i,
CA: /^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z] ?\d[ABCEGHJ-NPRSTV-Z]\d$/i,
IE: /^[A-Z]\d{2} ?[A-Z\d]{4}$/i,
NL: /^\d{4} ?[A-Z]{2}$/i,
DE: /^\d{5}$/
};
const NO_POSTCODE = ['HK', 'AE', 'QA'];
const LOOSE = /^[A-Za-z0-9][A-Za-z0-9 -]{1,8}[A-Za-z0-9]$/;
function isValidPostcode(value, country) {
const v = value.trim();
if (NO_POSTCODE.includes(country)) return true;
if (v === '') return false;
const rule = POSTCODE_RULES[country];
return rule ? rule.test(v) : LOOSE.test(v);
}Before
- One pattern: exactly 5 digits
- UK, Canadian and Irish codes rejected
- Postcode required in every country
- Server rule differs from the browser rule
After
- Rule chosen by selected country, loose fallback
- Local formats and spacing accepted
- Optional where no postcode exists
- Client and server share the same rule
How to confirm it's fixed
Re-run the country test
Submit the form once per country using the example postcodes, including lower case and no-space versions.
Check the result, not only the form
Confirm the entry reaches the inbox, CRM or order list with the postcode stored correctly.
Test on mobile and with autofill
Autofill may add a space or a different format than you typed.
How to prevent it happening again
- Keep a list of the countries you advertise in and a valid example postcode for each
- Add that list to your release checklist whenever a form, theme or checkout plugin changes
- Test every localised or geo variant page, not just the main one
- Avoid hand-written regex copied from forum answers without testing it
- Keep client and server rules in one place
- Review form error complaints from support, and read form analytics by country
How FunnelGuard handles this
FunnelGuard does not check this yet. Country-specific postcode validation is a possible future check, so today you should not rely on it for this problem.
What FunnelGuard does do nearby: a robot visitor runs your real lead form or checkout journey on a schedule from the EU or the US, checks each step, and confirms the test lead reaches your inbox and CRM. If a change to a form breaks the whole journey for the robot's test data, you get one alert with a screenshot and a likely cause. That covers the test address it uses, not every country's postcode format.
To watch for this issue yourself, put a quarterly reminder in your calendar to submit each localised form with a real postcode from each market. You can also check form analytics or your CRM for a country with unusually few submissions, and ask support to flag any address-rejected complaints. You can try the free plan (1 site, 2 journeys, daily checks, no card) to monitor your main journey, and a free read-only website audit is also available.
Questions people ask
Why is my form rejecting a valid UK postcode?
The form most likely uses a US-style rule that only accepts five digits, or a UK pattern that does not allow the space or lower case. UK postcodes mix letters and digits, such as SW1A 1AA. Change the rule to be country-aware or loosen it, and update the server check as well.
How do I validate postcodes for different countries?
Read the selected country and apply a pattern for that country, with a loose fallback for countries you have not mapped. Keep the same rule on the browser and server. Trim spaces and normalise case after validating, rather than rejecting the input.
Should a postcode field be required on a lead form?
Only if you need it, for example to route leads by area or to ship goods. Some countries have no postcode system, so a required field blocks them. Make it optional or required depending on the country.
Why does my checkout say the ZIP code is invalid for Canada?
Canadian postal codes follow the pattern letter, digit, letter, space, digit, letter, digit, such as K1A 0B1. A form expecting digits only will reject them. Check the country selection, then look for a custom pattern or plugin overriding the checkout's default address rules.
Do all countries have postcodes?
No. Countries such as Hong Kong, Qatar and the United Arab Emirates do not use a general postcode, and some others only introduced them recently. A form that requires a postcode everywhere blocks real customers from those places.
Should I use a regex or an address lookup service for postcodes?
A simple regex per country is enough for most lead forms, with a loose fallback. An address lookup service can validate the full address, but it adds cost and another point of failure. Choose a lookup only if delivery accuracy matters.
Does FunnelGuard check postcode validation by country?
No. FunnelGuard does not check this yet, and it is a possible future check. It runs your real form journeys on a schedule and confirms test leads arrive, but it does not test each country's postcode format.
Related issues
- CNV-035Phone validation rejects valid mobile numbersFix guide
- CNV-037Client and server validation disagree (passes client, server rejects)Fix guide
- CNV-031Required field can be left blank and the form still submitsFix guide
- CNV-032Validation error message not shown, form just does nothingFix guide
- CNV-029Valid email rejected (plus addressing, new TLDs)Fix guide
- CNV-030Invalid email acceptedFix guide