Loading...

US: /^[0-9]{5}(-[0-9]{4})?$/

UK: /^[A-Z]{1,2}[0-9][0-9A-Z]?\s?[0-9][A-Z]{2}$/i

Canada: /^[A-Z][0-9][A-Z]\s?[0-9][A-Z][0-9]$/i

Germany: /^[0-9]{5}$/

Japan: /^[0-9]{3}-[0-9]{4}$/


What Should You Call It in Your UI?


This depends on your audience:


  • US-only application: Use "ZIP Code"
  • UK-only application: Use "Postcode"
  • International application: Use "Postal Code" or "ZIP / Postal Code"
  • Adaptive application: Change the label based on the selected country

  • Tips for Developers


  • **Use the correct term for your market** - US users expect "ZIP Code," not "Postal Code"
  • **Always store as strings** - Never as integers
  • **Size your fields appropriately** - Allow at least 10 characters
  • **Validate per country** - One regex does not fit all
  • **Make the field optional for countries without postal codes**
  • Related Articles

    What Is a Fake Address Generator and How to Use OneUS Address Format Guide: How to Write American AddressesAddress Formats Around the World: A Developer Guide