How can I validate ZIP codes / postal codes?
If you wish to collect ZIP or postal codes, our ZIP code field is the perfect way to do it.
Open the form builder and click the "ZIP / postal code" field to insert this field:
While the field is selected, you can choose from 3 formats:
- ZIP code (USA)
- Postal code (CA)
- Post code (UK)
Notes on validation are as follows:
Zip code - USA
- Only allows numbers to be typed into the field
- Causes the numeric keyboard on mobile devices to be shown
- Requires a 6 digit numeric code (eg. 90210) OR the new Zip+4 format (eg. 90210-1234)
Postal code - Canada
- Requires a six-character alphanumeric code with alternating letters and numbers (e.g. K1A 0B1)
- Allows for an optional space or hyphen to be inserted between the third and fourth characters (e.g. K1A-0B1 or K1A 0B1).
Postcode - UK
Requires either a 6 or 7 character alphanumeric code in specific formats (eg. EC1A 1BB, W1A 0AX, M1 1AE).
The pattern must match the following regular expression:
^[A-Za-z]{1,2}[0-9Rr][0-9A-Za-z]? ?[0-9][A-Za-z]{2}$
- Starts with 1 or 2 letters
- Followed by a digit
- Optionally followed by an alphanumeric character
- May have a single space
- Ends with a digit and 2 letters (case-insensitive)