Skip to the content
Know your tech before you buy it. Makers: get listed from $49/mo

libphonenumber-js

github.com

  • Free plan
  • Web
  • API
7.2 Club score Visit github.com

What libphonenumber-js is

libphonenumber-js is a free JavaScript and TypeScript library for parsing and formatting personal phone numbers. It can check whether a number has a possible length and whether its digits meet phone-number rules. Its live formatter handles complete or partial number input, and a text-search function finds full phone numbers—including numbers with extensions—in text. Developers can select min, max, mobile, or custom metadata to tailor supported checks and bundle size. The README lists a 145 kB full build, with 65 kB of code and 80 kB of metadata, and compares it with a 550 kB build of Google’s library. The package is available through npm or for web pages using a script tag or an npm CDN. Its scope has limits: it does not handle emergency numbers, short codes, alphabetic numbers, or geolocation. The as-you-type formatter accepts digits and an initial plus sign, but ignores other punctuation and does not accept extensions during entry. It is licensed under MIT and Apache-2.0.

Who it suits

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

Good to know, and what to watch

  • Checks whether numbers are possible and valid.
  • Live formatting handles partial number input.
  • Searches text for numbers, including those with extensions.
  • Metadata choices let developers balance checks and bundle size.
  • Free under MIT and Apache-2.0 licenses.
  • Does not handle emergency numbers or short codes.
  • Geolocation is not supported.
  • As-you-type input does not accept extensions.
  • Strict digit validation may become outdated.

libphonenumber-js

Free

Free plan

The verdict

libphonenumber-js offers phone-number parsing, formatting, and checks with options for controlling metadata. Its unsupported number types and input constraints matter if your application needs those cases.

What the maker publishes

Bundle size
The README compares its 145 kB full build (65 kB code plus 80 kB metadata) with 550 kB for Google’s library. source
Input caveat
The “As You Type” formatter accepts digits and an initial plus sign, ignores other punctuation, and does not support entering extensions. source
Live formatting
Its “As You Type” formatter parses and formats complete or incomplete phone-number input. source
Metadata options
Developers can choose min, max, mobile, or custom metadata to balance supported checks and bundle size. source
Notable limits
It does not handle emergency numbers, short codes, alphabetic numbers, or geolocation, among other special cases described in the README. source
Purpose
A smaller JavaScript/TypeScript rewrite of Google Android’s libphonenumber for parsing and formatting personal phone numbers. source
React integration
The README directs developers building a React phone-number component to the separate react-phone-number-input project. source
Repository status
The README identifies GitLab as the primary repository and says GitHub is used as a backup. source
Support
The README says issues can be reported on GitHub or GitLab and gives instructions for reporting behavior differences from Google’s library. source
Text search
The library can find complete phone numbers in text, including numbers with extensions. source
Validation
It can check whether a number is possible by length and whether it is valid by checking its digits against phone-number rules. source
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. source
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. source

Checked against the maker's pages on 8 Oct 2026.