Data and storage

Convert to E.164

normalizeinternational
Pass numbers to SMS gateways, CRMs, and libphonenumber in international form.
Try it
Try 0120-123-456: toll-free numbers have no international form.

+819012345678

How it works

international is the E.164 form: +81 followed by the number without its leading 0. SMS gateways and CRMs usually require it, and libphonenumber parses it, so you can use both libraries side by side.

Toll-free (0120, 0800) and 0570 numbers have no international form. Their international is empty.

In each language

import { normalize } from "@kurashina-design/japan-phone";

// SMS gateways and CRMs usually expect E.164. libphonenumber reads the same form.
for (const input of ["090-1234-5678", "03-5253-8111", "050-3818-1250", "0120-123-456"]) {
  console.log(input, "->", normalize(input).international ?? "(domestic only)");
}

Output:

090-1234-5678 -> +819012345678
03-5253-8111 -> +81352538111
050-3818-1250 -> +815038181250
0120-123-456 -> (domestic only)