Skip to content
SPECIFICTION
Get listed

libphonenumber-js

github.com

Free plan WebAPI

What it is

libphonenumber-js is a free JavaScript and TypeScript library for parsing and formatting personal phone numbers. It can assess whether a number has a possible length and whether its digits fit phone-number rules. Its “As You Type” formatter handles complete or incomplete number input, and a search function can find full phone numbers, including those with extensions, in text. Developers can select min, max, mobile, or custom metadata to balance supported checks with package size. The README lists a 145 kB full build, consisting of 65 kB of code and 80 kB of metadata, and compares it with 550 kB for Google’s library. The package can be installed through npm or added to a web page with a script tag or npm CDN. It is available under MIT and Apache-2.0 licenses. Its coverage excludes emergency numbers, short codes, alphabetic numbers, and geolocation. The live formatter accepts digits and an initial plus sign, ignores other punctuation, and does not accept extensions as input. Strict digit checks may become stale as numbering plans change; the README suggests considering length-only validation for some applications.

Spec sheet

Purpose
A smaller JavaScript/TypeScript rewrite of Google Android’s libphonenumber for parsing and formatting personal phone numbers.Read 8 Oct 2026 · github.com
Support
The README says issues can be reported on GitHub or GitLab and gives instructions for reporting behavior differences from Google’s library.Read 8 Oct 2026 · github.com
Bundle size
The README compares its 145 kB full build (65 kB code plus 80 kB metadata) with 550 kB for Google’s library.Read 8 Oct 2026 · github.com
Input caveat
The “As You Type” formatter accepts digits and an initial plus sign, ignores other punctuation, and does not support entering extensions.Read 8 Oct 2026 · github.com
Live formatting
Its “As You Type” formatter parses and formats complete or incomplete phone-number input.Read 8 Oct 2026 · github.com
Metadata options
Developers can choose min, max, mobile, or custom metadata to balance supported checks and bundle size.Read 8 Oct 2026 · github.com
Notable limits
It does not handle emergency numbers, short codes, alphabetic numbers, or geolocation, among other special cases described in the README.Read 8 Oct 2026 · github.com
React integration
The README directs developers building a React phone-number component to the separate react-phone-number-input project.Read 8 Oct 2026 · github.com
Repository status
The README identifies GitLab as the primary repository and says GitHub is used as a backup.Read 8 Oct 2026 · github.com
Text search
The library can find complete phone numbers in text, including numbers with extensions.Read 8 Oct 2026 · github.com
Validation
It can check whether a number is possible by length and whether it is valid by checking its digits against phone-number rules.Read 8 Oct 2026 · github.com
Validation caveat
The README cautions that strict digit validation can become stale as numbering plans change and recommends considering length-only validation for some applications.Read 8 Oct 2026 · github.com
Web distribution
The package can be installed with npm or included in a web page through a script tag or npm CDN service such as unpkg or jsDelivr.Read 8 Oct 2026 · github.com

Plans and prices

libphonenumber-js Free Open-source JavaScript/TypeScript library · MIT and Apache-2.0 licenses Read 8 Oct 2026 · github.com

Every libphonenumber-js plan and price →

Strong points and limits

Strong points

  • Offers possible-length and digit-rule checks
  • Formats complete or partial input as it is typed
  • Can find phone numbers with extensions in text
  • Metadata options let developers balance checks and size

Limits

  • Does not handle emergency numbers or short codes
  • Live formatter does not accept extensions as input
  • Strict digit validation can become outdated

Who it suits

This library suits JavaScript and TypeScript developers who need phone-number parsing, formatting, validation, or text search. Developers building a React phone-number component are directed to a separate project.

Verdict

libphonenumber-js provides a focused set of phone-number parsing and formatting tools with selectable metadata. Its documented exclusions and validation caveat matter when an application handles special numbers or needs current numbering-plan checks.

Where Specifiction places it

Alternatives to libphonenumber-jsAll alternatives →