Compared with libphonenumber
Google's libphonenumber is a widely used library for numbers of many countries. For Japanese numbers, the two libraries format the same way. They differ in which numbers they accept and in how they read Japanese text.
We compared libphonenumber 9.0.45 for Java and libphonenumber-js 1.13.18 in December 2026, parsing with region JP and checking with isValidNumber.
Formatting is the same
For all 41,987 fixed-line blocks in the MIC tables, libphonenumber placed the hyphens exactly as japan-phone does. Mobile, 050, 0120, 0800, and 0570 numbers matched too.
Validity differs
libphonenumber accepted 27,113 fixed-line blocks that are not in the MIC tables. In 11,749 of them, the digit after the area code is 0 or 1; the MIC tables have no such block. japan-phone rejects them all.
| Input | japan-phone | libphonenumber |
|---|---|---|
03-1234-5678 | Invalid | Valid |
092-123-4567 | Invalid | Valid |
090--1234-5678 | Invalid | Valid |
090-ABCD-5678 | Invalid | Java converts it to 090-2223-5678; JavaScript cannot parse it |
The MIC tables have had no blocks added in the six years we checked (from December 2020), so we expect rejecting blocks outside them to rarely reject a real number.
Japanese text differs
| Input | japan-phone | libphonenumber |
|---|---|---|
〇九〇-一二三四-五六七八 | 090-1234-5678 | Cannot parse |
電話番号:03-5253-8111(内線21‐214) | 03-5253-8111 | Cannot parse |
libphonenumber can also find numbers in text (findNumbers). In most of our examples it found the same numbers as extract. extract also reads kanji digits and skips numbers that do not fit the numbering plan or the MIC tables. Where one number ends and the next begins can also differ with the input and the findNumbers settings. For example, in 03-5253-8111/03-5253-8111, extract found two numbers and findNumbers found none.
Sources
libphonenumber's metadata for Japan lists the same MIC page among its sources, together with the ITU and a third-party website. Its rules are summarized as regular expressions, and the version of each source is not recorded. japan-phone generates its table by program from the MIC files and records the URL, SHA-256, and date of each file.
Using both
- Use japan-phone to validate Japanese numbers strictly, and libphonenumber when you also handle numbers from other countries.
- Pass numbers between them in E.164: japan-phone's
internationalfield.