Regex for Japanese Postal Code (郵便番号)

Regex for Japanese postal codes in the standard 7-digit format with optional hyphen. Handles full-width digits and the leading 〒 mark.

Data Validation

Detailed Explanation

Regex for Japanese Postal Codes

Japanese postal codes (郵便番号) are seven digits, normally formatted as three digits, a hyphen, then four digits. They can appear with or without the hyphen, and historic forms include the postal mark 〒.

Standard Pattern (with hyphen)

^\d{3}-\d{4}$

Matches 100-0001 (Chiyoda-ku, Tokyo).

With or Without Hyphen

^\d{3}-?\d{4}$

Matches 100-0001 and 1000001.

With Optional 〒 Prefix and Hyphen

^〒?\d{3}-?\d{4}$

Matches 〒100-0001, 100-0001, 1000001.

Allow Full-Width Digits and Hyphen

Japanese forms commonly accept full-width characters:

^〒?[0-90-9]{3}[--ー‐]?[0-90-9]{4}$

Matches 100-0001 and 100ー0001.

Tested Examples

Input Standard Flexible
100-0001 yes yes
1000001 no yes
〒100-0001 no yes (with prefix variant)
100-0001 no yes
10-00001 no no
100-001 no no (only 6 digits total)

Normalizing Before Storage

Strip the prefix and hyphen before storing to keep entries consistent:

input
  .replace(/[0-9]/g, c => String.fromCharCode(c.charCodeAt(0) - 0xfee0))
  .replace(/[〒\--ー‐]/g, "")

Note on Real-World Validation

Regex confirms format only. To verify a code maps to a real address, query the Japan Post CSV (KEN_ALL.csv) or a paid address API.

Use Case

Validating shipping forms on Japanese e-commerce sites, normalizing CSV imports of customer addresses, or sanitizing user input before calling a postal-code-to-address lookup API.

Try It — Regex Cheat Sheet

Open full tool