Lesstep
Japanese forms · addresses · Checked October 29, 2026

Address forms in the Japanese order

A Japanese address is written from the largest place to the smallest: the postal code, the prefecture, the city, the town and block number, then the building. A form built for the US asks for the street first and the ZIP code last, so people in Japan fill it in backwards. Put the fields in the Japanese order, with these autocomplete tokens:

<input name="postal"
  inputmode="numeric"
  autocomplete="postal-code">
<select name="pref"
  autocomplete="address-level1">
</select>
<input name="city"
  autocomplete="address-level2">
<input name="line1"
  autocomplete="address-line1">
<input name="line2"
  autocomplete="address-line2">

Then fill in the prefecture, city and town from the postal code, as Japanese forms do, with Japan Post's free data (below).

What goes in each field

FieldExample
郵便番号, postal code100-0005
都道府県, prefecture東京都
市区町村, city or ward千代田区
町名・番地, town and block number丸の内1-2-3
建物名・部屋番号, building and room○○ビル 5階

The HTML standard describes the address levels this way: "in Japan the prefecture (level 1) precedes the city (level 2) which precedes the district (level 3)", and it encourages forms "presented in a way that matches the country's conventions". Google's address data, in its libaddressinput project, which Chromium uses for addresses, writes a Japanese address as 〒 and the postal code, then the prefecture, then the street address, the company, and the name last. It has no field of its own for the city, which starts the street address. Its US format starts with the name and ends with the ZIP code.

The standard mentions a third level for Japan. Google's format has neither a city nor a district field and puts both in the street address. We keep the city as its own field (level 2), as the standard describes, so the postal code can fill it in; the town (丸の内) starts the first address line, and the person adds the block number after it. The building and room go on a line of their own.

The 47 prefectures

Japanese users look for their prefecture in the national order, from Hokkaido in the north to Okinawa in the south, not in alphabetical order. Japan Post's data lists them in this order (by the national code, JIS X 0401), and so does Google's address data:

const PREFECTURES = [
  "北海道", "青森県", "岩手県",
  "宮城県", "秋田県", "山形県",
  "福島県", "茨城県", "栃木県",
  "群馬県", "埼玉県", "千葉県",
  "東京都", "神奈川県", "新潟県",
  "富山県", "石川県", "福井県",
  "山梨県", "長野県", "岐阜県",
  "静岡県", "愛知県", "三重県",
  "滋賀県", "京都府", "大阪府",
  "兵庫県", "奈良県", "和歌山県",
  "鳥取県", "島根県", "岡山県",
  "広島県", "山口県", "徳島県",
  "香川県", "愛媛県", "高知県",
  "福岡県", "佐賀県", "長崎県",
  "熊本県", "大分県", "宮崎県",
  "鹿児島県", "沖縄県",
];

for (const name of PREFECTURES) {
  pref.add(new Option(name, name));
}

Four of them don't end in 県 (ken, prefecture): 北海道, 東京都, 京都府 and 大阪府. Use the full names as the values, as above, rather than adding 県 to a name. Japan Post's data uses the same full names, so the code below can set the select by its value.

Fill in the address from the postal code

Japan Post publishes every postal code with its prefecture, city and town, updated every month, and says in its notes on the data that it does not claim copyright on it and that you may distribute it freely. Use the UTF-8 file, utf_ken_all.zip, added in June 2023, which writes each entry on one line. The older KEN_ALL.CSV is in Shift_JIS, writes readings in half-width katakana, and splits a town name longer than 38 characters over several rows. Japan Post has also offered a free API since May 2025, which needs registration.

The September 30, 2026 file has 124,526 rows for 120,720 postal codes. Split it by the first three digits, and the browser loads one small file when someone types a code. This script made 948 files, the largest 107 KB:

import csv
import json
import os
from collections import defaultdict

files = defaultdict(dict)
with open("utf_ken_all.csv",
          encoding="utf-8",
          newline="") as f:
    for row in csv.reader(f):
        code = row[2]
        group = files[code[:3]]
        group.setdefault(code, [])
        group[code].append({
            "pref": row[6],
            "city": row[7],
            "town": row[8],
        })

os.makedirs("postal", exist_ok=True)
for head, codes in files.items():
    path = f"postal/{head}.json"
    with open(path, "w",
              encoding="utf-8") as f:
        json.dump(codes, f,
                  ensure_ascii=False)

Before you write a row into the form, three things in the data:

In the browser, with toAsciiNumber from the full-width digits page, where postal, pref, city and line1 are the fields above:

// Notes in Japan Post's data,
// not town names
const OTHER = "以下に掲載がない場合";
const NO_TOWN = "の次に番地がくる場合";

function townFor({ city, town }) {
  const name = town.replace(/(.*/, "");
  const whole = name.endsWith("一円") &&
    name !== "一円" &&
    city.endsWith(name.slice(0, -2));
  if (whole || name === OTHER ||
      name.endsWith(NO_TOWN)) {
    return "";
  }
  return name;
}

async function lookup(code) {
  const head = code.slice(0, 3);
  const res = await fetch(
    `/postal/${head}.json`);
  if (!res.ok) return [];
  const codes = await res.json();
  return codes[code] ?? [];
}

async function fill() {
  const raw = postal.value;
  const code = toAsciiNumber(raw)
    .replace("-", "");
  if (!/^\d{7}$/.test(code)) return;
  const rows = await lookup(code);
  const places = new Set(
    rows.map((r) => r.pref + r.city));
  if (places.size !== 1) return;
  pref.value = rows[0].pref;
  city.value = rows[0].city;
  if (line1.value || rows.length > 1) {
    return;
  }
  line1.value = townFor(rows[0]);
}

postal.addEventListener("input",
  (e) => e.isComposing || fill());
postal.addEventListener(
  "compositionend", fill);

In Chromium 152, typing 100-0005 filled in 東京都, 千代田区 and 丸の内, and the same code in full-width digits, 100ー0005, inserted as text, did the same. 452-0961 filled in only 愛知県 and 清須市, and 950-0102 nothing. In Node.js 24, townFor on every row emptied the 1,909 notes and kept 一円 in Taga.

The isComposing check skips the digits while a Japanese input method is still composing them, and compositionend runs the lookup when the person confirms them (more on composition). A code your copy doesn't have finds nothing, and the person types the address: the codes Japan Post gives large businesses are in a separate file, and new codes arrive every month.

The postal code itself

A Japanese postal code is seven digits, written 100-0005, often after the postal mark 〒. Google's address data accepts it with or without the hyphen (\d{3}-?\d{4}). Accept both, and full-width digits too (how), and store the seven digits.

Keep it as text, not a number. 14,081 codes start with 0, in Hokkaido, Aomori, Iwate and Akita, and Number("0600042") is 600042. Japan Post's own download page warns that spreadsheets drop the leading 0 or 00, or show some codes as dates. And don't reject a code because your copy of the data doesn't have it.

The rest of a Japanese check

An address form is the last step before a delivery or an invoice, and one in the wrong order makes people type their address backwards. The same pass catches Enter while typing Japanese (the fix), yen charged 100 times over (the fix), kanji drawn in their Chinese shapes (the fix), headings that break in the middle of a word (the fix), postal codes rejected when typed in Japanese (the fix), dates saved one day early in Japan (the fix), phone numbers sent to +81 with the 0 still in (the fix), PDFs with the Japanese missing (the fix), search that finds nothing in Japanese (the fix), previews cut down to “...” in Japanese (the fix), lists sorted in the wrong order (the fix), email subjects that arrive garbled (the fix), CSV files that open garbled in Excel (the fix), Japanese titles that give an empty URL slug (the fix), file names garbled on upload and download (the fix), dates in the Japanese era that come out wrong (the fix), full-width spaces that get past your checks (the fix), public holidays your app gets wrong (the fix), and vertical text that comes out sideways or upside down (the fix).

Lesstep translates web apps into Japanese and delivers them as one pull request. In Complete (US$249), we put your address forms in the Japanese order, with these autocomplete tokens and the prefecture list, and, if you want it, fill in the address from the postal code, in the same pull request. The first step is a free sample.

Google is a trademark of Google LLC; Node.js is a trademark of the OpenJS Foundation; Python is a trademark of the Python Software Foundation. This page is not affiliated with or endorsed by any of them, or by Japan Post.

More: Enter sends the message while typing Japanese · Stripe charges 100 times too much in yen · Kanji in their Chinese shapes · Japanese headings that break in the middle of a word · Forms that reject numbers typed in Japanese · Dates that come out wrong for Japanese users · Japanese phone numbers in forms · Japanese text missing from your PDFs · Search that finds nothing in Japanese · Length limits that break in Japanese · Japanese lists sorted in the wrong order · Japanese email subjects that arrive garbled · Japanese CSV files that open garbled in Excel · Japanese titles that give an empty URL slug · Japanese file names garbled on upload and download · Japanese era dates that come out wrong · Full-width spaces that get past your checks · Japanese public holidays your app gets wrong · Japanese vertical text that comes out sideways or upside down · Japanese localization checklist · Japanese localization for your web app