Canada Postal Validator
Validate the format of a Canadian postal code (A1A 1A1 pattern, alternating letter and digit). Useful for forms, e-commerce and shipping to Canadian customers.
Canadian postal code: the alternating ANA NAN pattern
A Canadian postal code is six characters in the pattern A9A 9A9 — letter, digit, letter, space, digit, letter, digit. Introduced by Canada Post between 1971 and 1974, it splits into a Forward Sortation Area (FSA) — the first three characters — and a Local Delivery Unit (LDU) — the last three. The validator on this page checks the structural pattern, accepting K1A 0B1 (the famous code of the Prime Minister's Office / Canada Post HQ in Ottawa).
There is no check digit: validity comes from existence in Canada Post's address database. The alternating letter/digit design and the excluded letters make the format very robust against typos and OCR errors — a deliberate choice for mechanised sorting.
Anatomy of K1A 0B1
- 1st letter: postal district / province (e.g.
KEastern Ontario,MToronto,HMontréal,VBritish Columbia,TAlberta). - 1st digit:
0means a rural FSA;1–9 means urban. - FSA (first 3,
K1A): the sorting station and neighbourhood. - LDU (last 3,
0B1): a city block, a rural route, or a single large-volume recipient.
Excluded letters
- Never used at all:
D, F, I, O, Q, U— too easy to confuse with digits or each other. - Never used as the first letter:
WandZ. - So a strict regex is
[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z] \d[ABCEGHJ-NPRSTV-Z]\d.
Where it shows up
- Address forms: postal code lookup auto-fills city + province; the standard Canadian checkout flow.
- Shipping & tax: Canada Post rating, plus the FSA helps determine provincial sales tax (GST/PST/HST).
- Geo & census: Statistics Canada publishes data by FSA.
- Mock data / testing: generating format-valid codes for fixtures and form QA.
Gotchas
- Case and space: normalise to uppercase and insert the space before the LDU;
k1a0b1andK1A 0B1are the same code. - Letter O vs digit 0: O is never a letter position, so any apparent O is really a zero — a classic OCR fix.
- Format-valid ≠ deliverable: only Canada Post's database confirms a code is live; the pattern alone doesn't.
- FSA
x0x: the rural marker (second char 0) changes delivery assumptions; don't ignore it.
FAQ
Why letters and digits alternating? The ANA NAN design maximises the number of codes in six characters while staying easy for humans and machines to read — far more combinations than six digits.
What does the space mean? Purely a readability separator between FSA and LDU; matching is done after normalising it.
Is there a check digit? No. Validity is by lookup against Canada Post, plus the excluded-letter rules that make the format self-checking against many typos.
Related Tools
France Postal Validator
Validate the format of a French postal code (5 digits). Useful for forms, e-commerce and international shipping to customers in France.
Japan Postal Validator
Validate the format of a Japanese postal code (〒NNN-NNNN). Useful for forms, e-commerce and international shipping to customers in Japan.
Portugal Postal Code Validator
Validate Portuguese postal codes (####-###) and identify region by first two digits (Lisboa, Porto, Coimbra, etc.).
UK Postcode Validator
Validate the format of a UK postcode, such as SW1A 1AA. Useful for forms, e-commerce and sign-ups that serve customers in the United Kingdom.
Germany Postal Validator
Validate the format of a German postal code (PLZ, 5 digits). Useful for forms, e-commerce and international shipping to customers in Germany.
Brazilian Boleto Decoder (Typeable Line & Barcode)
Decodes Brazilian boleto slips: converts the typeable line into the 44-digit barcode, checks every digit and extracts bank, due date and amount.