Billing Postal Code Generator

Fill the postal code field on a checkout form with codes from 11 countries. Each one starts with a real regional prefix, carries its state or province code, and comes in the exact shape a payment form expects. Flip to invalid mode for codes your validator should reject.

Billing country
Codes per click
Mode

Sample below: five real US ZIP codes. Pick a country, then press Generate.

Billing postal codes

  1. 0110016New York NY
  2. 0294107California CA
  3. 0360611Illinois IL
  4. 0402134Massachusetts MA
  5. 0578701Texas TX

United States pattern

Shape: 12345 or 12345-6789

/^\d{5}(?:-?\d{4})?$/

What the postal code does at checkout

On a card payment, the billing postal code is the one address detail almost every processor checks. The Address Verification Service, AVS, sends the numeric parts of the billing address to the bank behind the card. The bank compares them with the address on file and returns a one-letter result. Your fraud rules decide what to do with each letter.

AVS runs mainly on cards from the United States, Canada, and the United Kingdom. A card issued in Germany, India, or Japan usually comes back as unavailable, whatever the shopper types. Treat the postal field as required for those three countries and as format-checked only everywhere else.

Common AVS result codes
CodeStreetPostal codeTypical handling
YMatchMatchApprove
ZNo matchMatchApprove, flag for review on high-value orders
AMatchNo matchReview. Often a recent move or a typo in the code
NNo matchNo matchDecline or hold
UIssuer has no address dataRely on other signals
GNon-US issuer outside AVSRely on other signals

Payment platforms rename these. Stripe, for one, reports address_postal_code_check as pass, fail, unavailable, or unchecked. In test mode the result comes from the test card number, never from the code you type. Stripe's card 4000 0000 0000 0036 forces a failed postal check, so pair the card with any valid code from this page to see how your checkout handles the decline.

Postal code formats for all 11 countries

Pick the Copy regex button above to grab the pattern for the selected country. The table lists the shape of each code and the one rule checkout forms break most often.

CountryNameShapeThe rule forms miss
United StatesZIP code02134, 02134-1201New England, New Jersey, and Puerto Rico ZIPs start with 0. Store the field as text.
United KingdomPostcodeSW1A 2AAFive to seven characters plus a space before the last three. The last two letters never use C, I, K, M, O, or V.
CanadaPostal codeM5V 3L9The first letter names the province. D, F, I, O, Q, and U never appear anywhere in the code.
AustraliaPostcode0800Northern Territory codes start with 0. Darwin is 0800.
GermanyPLZ01067Dresden and Leipzig start with 0. No code starts with 00.
JapanPostal code060-0001Hyphen after the third digit. Sapporo starts with 0. Shoppers often paste the 〒 mark along with the code.
IndiaPIN code110001The first digit names one of nine zones. A PIN never starts with 0.
ChinaPostal code100000Six digits. The first two name the province or city, such as 10 for Beijing and 20 for Shanghai.
RussiaPostal index101000Six digits. Moscow alone spans 101 through 129, so a city lookup by prefix needs ranges.
PakistanPostal code54000Five digits. Karachi uses two prefixes, 74 and 75.
Saudi ArabiaPostal code12271-3456Five digits, plus an optional four-digit additional number from the National Address system.

Five checkout bugs these codes expose

The ZIP column is a number

The sample on this page includes 02134, a Boston ZIP. Save it to an integer column, or open the export in Excel, and you get 2134. The order then fails AVS on every retry. Generate Massachusetts or New Jersey codes and check what your database hands back.

maxlength="5" on a global form

A US-only limit truncates EC1A 1BB to EC1A and 060-0001 to 060-0. The longest shapes here are ZIP+4 at 10 characters and London postcodes at 8. Set the limit to 10, or remove the attribute.

State and ZIP disagree

Tax engines and some fraud rules compare the state field with the ZIP prefix. Every US, Canadian, and Australian row on this page shows its state or province code in the row. Pair a Texas ZIP with a Florida state on purpose then check if your form flags the mismatch before the payment step.

Spacing and case break matching

Shoppers type sw1a2aa as often as SW1A 2AA. Normalize before you validate: uppercase, strip spaces, then put one space before the last three characters for UK and Canadian codes. The Lowercase and No space styles give you rows for this test.

A numeric keypad for every country

inputmode="numeric" on the postal field gives US shoppers a tidy keypad and locks out every UK and Canadian buyer on mobile. Switch the input mode when the billing country changes, then test with a UK row on a phone.

How invalid mode builds its codes

Invalid mode starts from a real code and breaks one rule at a time: a dropped leading zero, a forbidden letter, a missing half, a misplaced hyphen. Each row prints the broken rule underneath, so a failing test tells you which check is missing. A batch of five or more covers every rule for the chosen country.

One US row is a trap on purpose. 00000 passes any five-digit pattern, including the regex above, yet no area uses the code. A validator accepting 00000 needs a lookup, not a stricter pattern.

Where this generator falls short

Billing postal code questions

Are these real postal codes?

The sample rows are real ZIP codes, such as 10016 in Manhattan and 94107 in San Francisco. Generated rows start with a real regional prefix and end in random characters, so the shape and region are right while some full codes are unassigned.

Will a generated code pass AVS?

Not on a live card. AVS compares the code with the address the bank holds for the card. In a payment sandbox the result depends on the test card number, so any valid code from this page works there.

What is a billing postal code?

The postal code of the address where the card issuer sends statements. The code often differs from the shipping code, which is why checkout forms ask for both.

Why do some codes start with 0?

ZIPs across New England, New Jersey, and Puerto Rico start with 0, as do Northern Territory postcodes, Dresden and Leipzig PLZ codes, and Sapporo codes. They are the best rows for catching fields stored as numbers.

What does the pattern checker test?

Shape only. The checker runs the regex for the selected country against your pasted code, after trimming spaces at each end. A pass means the format is right, not the code assigned.

How many codes per click?

Up to 25. Valid mode never repeats a code inside one batch. Invalid mode cycles through every rule for the country before repeating one.