Same postal code, different addresses from the first character? Japan's seven-digit system
Can a form safely fill in the prefix shared by all addresses under a postal code? Data for about 120,000 Japanese codes shows why even a prefix that names a real locality may leave the choice open.
An address can start filling itself in the moment you enter a postal code. If I were writing that feature, I would look up all seven digits, compare any candidates character by character, and fill in the longest shared prefix. For 072-0819 in Bibai, Hokkaido, that means 「北海道美唄市共練町」, or Hokkaido, Bibai, Kyōrenchō. Then the resident can choose 東 (east) or 西 (west). Both Bibai results at Japan Post
What if the next field asks for the block and lot number (banchi)? A form that moves on with just Kyōrenchō can collect the right code and lot number while dropping east or west from the shipping label. Every character from the prefix belongs to both candidates, yet the resulting locality appears in neither.
Could we look the prefix up in a locality directory? There is a real example that passes that test as well.
Mojiri passes the locality lookup
Japan Post lists 「茂尻」 (Mojiri) and 「茂尻栄町」 (Mojiri Sakaemachi) for 079-1266 in Akabira, Hokkaido. Both start with 「茂尻」, and taking just that prefix gives the first locality exactly. Both Akabira results at Japan Post
Suppose two people are sending parcels, one to Mojiri and one to Mojiri Sakaemachi. After the seventh digit, the server has seen the same input. Confirming Mojiri and moving the cursor to the lot number helps the first person and takes away the second person’s chance to type Sakaemachi. A directory of official locality names would accept it.
The prefix in Bibai is incomplete. The prefix in Akabira looks complete by chance, which makes the mistake harder to catch. I wanted to count “Do all candidates start with these characters?” separately from “Do all candidates have the same locality field?” Before that, why can one code cover such combinations?
What decision did a code reader make in 1968?
On July 1, 1968, when Japan introduced postal codes, the TR-4 automatic reader and sorter was unveiled at Tokyo Central Post Office. Its developers used 300,000 sample characters to improve handwritten digit recognition. There were 100 pockets for sorted mail, and a production unit could handle 22,000 pieces an hour. For each postcard the machine had to decide which pocket to send it to. The first automatic reader and sorter, Postal Museum
Codes had three or five digits. For distant destinations the sending office could use the first two to route mail to a regional hub. The hub used three or five to sort it onward to the delivery office. In this two-stage process documented by Japan’s Board of Audit, a numeric prefix did its job once the next hop was known. It did not need to align with prefecture or municipality boundaries. Board of Audit report on postal codes and sorting
Japan moved to seven digits on February 2, 1998. The general rule was to add four digits to a three-digit code or two to a five-digit code, identifying localities within a delivery area. Wakabayashi in Setagaya Ward, Tokyo, went from 154 to 154-0023. Komuro in Kawagoe, Saitama, went from 350-11 to 350-1106. Both now have a hyphen after the third digit, but the 11 in Komuro’s final four digits was already there. History of the system (PDF) · Japan Post’s old and new code examples
The rest of the address still does work. Japan Post’s manual shows a sorter reading both 154-0023 and 3-16-4-205 for apartment 205, building 4, block 16, Wakabayashi 3-chōme. It prints a barcode in transparent ink, and the delivery office reads it to put mail in delivery order. Online shops work in the opposite direction, starting with a postal code before anyone has given them the address. Japan Post’s mail-processing guide
Where addresses diverge for 1,338 codes nationwide
I used the nationwide one-row-per-record UTF-8 file updated October 30, 2026. The old format can split long names across lines. I read the seven digits as text and combined rows of a code only when prefecture, municipality or ward, and locality all matched. Parentheses and instructions stayed as published. Codes assigned to individual large organizations are in a separate dataset. Japan Post’s nationwide CSV · Column definitions
The 124,527 rows contained 120,721 distinct codes and 124,526 code and written address pairs. A dictionary keeping only the first match loses 3,805 pairs. Sorting changes which pairs are lost.
I counted where the addresses first diverged for the 1,338 codes with multiple written addresses. I separated areas with at least one common starting character, as in Bibai, from areas that differ from the first character.
| Where candidates start to differ | Postal codes |
|---|---|
| Different prefectures | 3 |
| Different municipalities or wards within one prefecture | 131 |
| Same municipality, different first locality character | 503 |
| Same municipality, at least one shared first locality character | 701 |
For 236 of the last 701 codes, the longest common prefix was itself one of the candidates, as in Akabira. The prefix alone matched none of the candidates for the other 465. A form can show the prefix in all 701 cases while leaving the locality to be selected. The CSV counts codes and tells us nothing about the share of users or parcels they represent.
Three codes without even a shared first prefecture character
The nationwide CSV contains all 100 two-digit prefixes from 00 through 99. Of those, 20 span prefectures. At five digits it is 19 out of 5,588 combinations. Even when all seven digits match, three codes leave the prefecture undecided.
- 498-0000 — Yatomi, Aichi Prefecture, and Kisosaki in Kuwana District, Mie Prefecture
- 618-0000 — Ōyamazaki in Otokuni District, Kyoto Prefecture, and Shimamoto in Mishima District, Osaka Prefecture
- 871-0000 — Yoshitomi in Chikujō District, Fukuoka Prefecture, and Nakatsu, Ōita Prefecture
The first characters of the Japanese addresses are 「愛」 and 「三」, 「京」 and 「大」, 「福」 and 「大」. All three pairs share zero characters. In all six records the locality field says 「以下に掲載がない場合」, “if the locality is not listed below.” This is a fallback for localities without their own entry in the municipality. The phrase does not go on the label, and the pairs are not named localities crossing prefecture boundaries. Japan Post data notes · Lookup for 498-0000
Even without fallback rows, 999-4554 in Yamagata has two specific results, 尾花沢市芦沢 (Ashizawa, Obanazawa) and 北村山郡大石田町鷹巣(岡草山) (Takanosu, Okakusayama area, Ōishida, Kitamurayama District). They share only the prefecture. The CSV gives their old codes as 99945 and 99941. The current codes agree although the fifth digit of the old ones differs, an exception to the general rule that digits carried over. Across all 124,527 rows, 3,807 old codes differed from the start of the current code. The file doesn’t record why individual codes changed. Both results for 999-4554
Tracing 66 Kiyosu addresses back before a merger
Kiyosu, Aichi Prefecture, had the most written addresses for a single code. The list for 452-0961 starts with 「春日明河原」, includes 「春日一本松」 and ends with 「春日蓮花寺前」. The 66 all start with 「愛知県清須市春日」, Aichi Prefecture, Kiyosu, Haruhi. A city table of old and new addresses gives a clue why. Japan Post lookup for 452-0961 · Kiyosu guide for former Haruhi Town
Haruhi Town of Nishikasugai District merged into Kiyosu on October 1, 2009. The city says “Kiyosu” replaced the old town and district, that 「大字落合」 (Ōaza Ochiai) and 「大字下之郷」 (Ōaza Shimonogō), former address subdivisions, became 「春日」 (Haruhi), and that the marker 「字」 disappeared. 「大字落合字一本松」, for example, became 「春日一本松」. Ipponmatsu survived while the preceding name changed. Merger date and addressing guide · Old and new locality names
I matched the current names to the city table individually. All 66 had a former counterpart starting with 「大字落合字」. Comparing two rows alone wouldn’t show that the same historical place name links all 66. The table documents address changes. It leaves open who assigned the postal code or when.
The reverse lookup finds 89 Kiyosu localities starting 「春日」. Alongside the 66 under 452-0961 are 22 under 452-0962, including 「春日県」, and one under 452-0964, 「春日さくら」. A code can lead to a common Haruhi prefix, while that prefix leads to three codes. The same problem appears in reverse as someone types part of a locality. Japan Post results for Haruhi in Kiyosu
The kanji all match. Can the form fill in the reading?
The national count came to 124,527 rows and 124,526 unique code and address pairs. Before discarding that single difference as a duplicate, I looked for the code with the exact same prefecture, municipality and locality twice.
It was 673-0012 in Akashi, Hyōgo. The locality was 和坂 in both rows, but the phonetic kana in columns 4–6 gives カニガサカ (Kanigasaka) in one and ワサカ (Wasaka) in the other. Column 12, Japan Post’s flag for localities with a numbered subdivision called chōme, is 0 for Kanigasaka and 1 for Wasaka. Akashi’s registry also lists only 和坂 1–3-chōme as residential numbering districts. Treating these as interchangeable pronunciations would erase this distinction. Both readings at Japan Post · Akashi residential numbering districts
For a label in kanji, both rows give 「兵庫県明石市和坂」, Hyōgo, Akashi, 和坂. An application that stores the phonetic reading still has two choices. Counting readings separately changes the number of codes with multiple candidates from 1,338 to 1,339. A unique answer depends on which fields you save.
Back to the address form
Use all seven digits and retrieve every matching row. Fill the prefecture when it is the same everywhere, and do the same for the municipality or ward. Where values differ, show choices linked to their source rows. If the user chose Obanazawa, offering Ōishida’s Takanosu (Okakusayama area) would let the form create an address absent from the data.
Kyōrenchō is a helpful hint in Bibai. Store it after the user chooses the east or west locality in full. Let users explicitly select Mojiri or Mojiri Sakaemachi, and keep the phonetic reading editable in Akashi even after the kanji are filled in. Display fallback text and parenthetical conditions as selection guidance. If the lookup returns nothing, keep the typed address. It could have a code for an organization outside this dataset. Japan Post’s dataset coverage and notes
If checkout shows the wrong locality, look up the address given by the recipient at Japan Post. If the chōme and block or lot range are covered and the code matches, select or correct the locality and check the address before confirming. Tell the shop if the field is locked. The business ordering site iDATEN says it keeps a single address per code, which can display an unintended result, and suggests manual entry. Japan Post lookup · iDATEN FAQ
My last test for an address form would use the same Akabira code twice. Choose Mojiri once and Mojiri Sakaemachi the next time. Both should save as distinct destinations. If both end up as Mojiri, the lookup succeeded twice. The program failed by deciding which locality the users meant.
Reproduce the national counts and address prefix check in Python
Download utf_ken_all.zip from Japan Post’s nationwide dataset and run this code in the same folder. I tested it with Python 3.12.14. It prints all Bibai and Akabira candidates, and the counts and prefix for larger sets like Kiyosu. It compares the published characters directly and keeps district and designated-city ward names in the original municipality field. The October 30, 2026 CSV had SHA-256 33a3a1e14a69778282cfb22c17ba0b5f888669d091ada93e1ba960f259f6b2d5. The distributed file changes over time, so a different month can give different counts. The sample output labels are Japanese.
import csv
from collections import Counter, defaultdict
from io import TextIOWrapper
from os.path import commonprefix
from zipfile import ZipFile
with ZipFile("utf_ken_all.zip") as archive:
with archive.open("utf_ken_all.csv") as raw:
rows = list(csv.reader(TextIOWrapper(raw, encoding="utf-8", newline="")))
addresses = defaultdict(set)
with_kana = defaultdict(set)
for row in rows:
code = row[2] # 先頭の0も含む7桁
address = tuple(row[6:9])
addresses[code].add(address)
with_kana[code].add((address, tuple(row[3:6])))
print("行数/番号数/番号と住所表記の組",
len(rows), len(addresses), sum(map(len, addresses.values())))
print("先頭1件だけで消える候補", sum(len(a) - 1 for a in addresses.values()))
print("読みも区別すると複数候補", sum(len(a) > 1 for a in with_kana.values()))
groups = Counter()
prefix_is_candidate = 0
for candidates in addresses.values():
if len(candidates) == 1:
continue
if len({a[0] for a in candidates}) > 1:
groups["都道府県が異なる"] += 1
elif len({a[1] for a in candidates}) > 1:
groups["市区町村が異なる"] += 1
else:
towns = [a[2] for a in candidates]
prefix = commonprefix(towns)
if prefix:
groups["町域の先頭が共通"] += 1
prefix_is_candidate += prefix in towns
else:
groups["町域の先頭が異なる"] += 1
print("複数表記の番号", sum(groups.values()), dict(groups))
print("共通部分そのものも町域の候補にある", prefix_is_candidate)
for digits in (2, 5, 7):
areas = defaultdict(set)
for code, candidates in addresses.items():
areas[code[:digits]].update(a[0] for a in candidates)
print("桁数/組数/都道府県をまたぐ組", digits, len(areas),
sum(len(prefs) > 1 for prefs in areas.values()))
for code in ("0720819", "0791266", "4520961", "9994554", "4980000", "6730012"):
candidates = sorted(addresses[code])
prefix = commonprefix(["".join(a) for a in candidates])
print(code, len(candidates), repr(prefix))
if len(candidates) <= 2:
print(candidates)
largest = max(addresses, key=lambda code: len(addresses[code]))
print("最大", largest, len(addresses[largest]))
print("清須市で春日から始まる町域",
Counter(r[2] for r in rows if r[6:8] == ["愛知県", "清須市"]
and r[8].startswith("春日")))
print("旧番号が現番号の先頭と異なる行",
sum(not r[2].startswith(r[1].strip()) for r in rows))
print("和坂の町域/読み/丁目フラグ",
[(r[8], r[5], r[11]) for r in rows if r[2] == "6730012"])