- Home
- Phone Number Validation Software
- libphonenumber-js
libphonenumber-js
What it is
libphonenumber-js is a free JavaScript and TypeScript library for parsing and formatting personal phone numbers. It checks whether a number’s length is possible and whether its digits conform to phone-number rules. Its live formatter handles complete or partial number entry, and a text-search function can find full phone numbers, including extensions, in text. Developers can select min, max, mobile, or custom metadata to adjust 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 550 kB for Google’s library. The package is available through npm or can be added to a web page using a script tag or npm CDN. Strict digit checks may become outdated as numbering plans change, so the README suggests considering length-only checks for some uses. The formatter accepts digits and an initial plus sign, ignores other punctuation, and does not support entering extensions. It does not handle emergency numbers, short codes, alphabetic numbers, or geolocation. The library is licensed under MIT and Apache-2.0.
For and against
For
- Free under MIT and Apache-2.0 licenses
- Formats complete or partial number input
- Finds phone numbers with extensions in text
- Offers selectable metadata options
- Available through npm and web-page scripts
Against
- Does not handle emergency numbers or short codes
- Formatter does not support entering extensions
- Strict digit checks can become outdated
The verdict
libphonenumber-js combines parsing, formatting, and text search with metadata choices that let developers balance checks and bundle size. Its documented limits matter for applications involving special number types or extension entry.
Who it suits
It suits JavaScript and TypeScript developers building phone-number parsing, formatting, or text-search features. Developers building a React phone-number component are directed to the separate react-phone-number-input project.
Plans and prices
libphonenumber-js
Open-source JavaScript/TypeScript library · MIT and Apache-2.0 licenses
Read 8 Oct 2026 · github.com
On the record
- Bundle size
- The README compares its 145 kB full build (65 kB code plus 80 kB metadata) with 550 kB for Google’s library.github.com · read 8 Oct 2026
- Input caveat
- The “As You Type” formatter accepts digits and an initial plus sign, ignores other punctuation, and does not support entering extensions.github.com · read 8 Oct 2026
- Live formatting
- Its “As You Type” formatter parses and formats complete or incomplete phone-number input.github.com · read 8 Oct 2026
- Metadata options
- Developers can choose min, max, mobile, or custom metadata to balance supported checks and bundle size.github.com · read 8 Oct 2026
- Notable limits
- It does not handle emergency numbers, short codes, alphabetic numbers, or geolocation, among other special cases described in the README.github.com · read 8 Oct 2026
- Purpose
- A smaller JavaScript/TypeScript rewrite of Google Android’s libphonenumber for parsing and formatting personal phone numbers.github.com · read 8 Oct 2026
- React integration
- The README directs developers building a React phone-number component to the separate react-phone-number-input project.github.com · read 8 Oct 2026
- Repository status
- The README identifies GitLab as the primary repository and says GitHub is used as a backup.github.com · read 8 Oct 2026
- Support
- The README says issues can be reported on GitHub or GitLab and gives instructions for reporting behavior differences from Google’s library.github.com · read 8 Oct 2026
- Text search
- The library can find complete phone numbers in text, including numbers with extensions.github.com · read 8 Oct 2026
- Validation
- It can check whether a number is possible by length and whether it is valid by checking its digits against phone-number rules.github.com · read 8 Oct 2026
- 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.github.com · read 8 Oct 2026
- 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.github.com · read 8 Oct 2026