HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
google
libphonenumber
C++2014–2025
google / libphonenumber

libphonenumber

Google's common Java, C++ and JavaScript library for parsing, formatting, and validating international phone numbers.

43Distinct people
44Mentions
0Explicit recommenders
18.4KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Google's common Java, C++ and JavaScript library for parsing, formatting, and validating international phone numbers.

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 1:49:46 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year44 dated mentions

Observed mentions: 2014-12-15 06:04:05 UTC to 2025-02-17 03:36:52 UTC.

02468102014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments20142015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 4 mentions; 2 submissions, 2 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 3 mentions; 3 submissions, 0 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 4 mentions; 1 submissions, 3 comments20192020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 5 mentions; 3 submissions, 2 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 6 mentions; 1 submissions, 5 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 9 mentions; 5 submissions, 4 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 4 mentions; 2 submissions, 2 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2025

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC110
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC404
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC422
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC101
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC330
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC413
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC101
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC532
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC615
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC954
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC422
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC202

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
What is it? Google's common Java, C++ and JavaScript library for parsing, formatting, and validating international phone numbers. The Java version is optimized for running on smartphones, and is used by the Android framework since 4.0 (Ice Cream Sandwich). Quick links Reporting an issue? Want to send a pull request? See the contribution guidelines Check the frequently asked questions Fun! Falsehoods Programmers Believe About Phone Numbers Look for READMEs in directories relevant to the code you're interested in. For contributors and porters: How to run the Java demo For porters: How to make metadata changes Highlights of functionality Parsing, formatting, and validating phone numbers for all countries/regions of the world. getNumberType - gets the type of the number based on the number itself; able to distinguish Fixed-line, Mobile, Toll-free, Premium Rate, Shared Cost, VoIP, Personal Numbers, UAN, Pager, and Voicemail (whenever feasible). isNumberMatch - gets a confidence level on whether two numbers could be the same. getExampleNumber and getExampleNumberForType - provide valid example numbers for all countries/regions, with the option of specifying which type of example phone number is needed. isPossibleNumber - quickly guesses whether a number is a possible phone number by using only the length information, much faster than a full validation. isValidNumber - full validation of a phone number for a region using length and prefix information. AsYouTypeFormatter - formats phone numbers on-the-fly when users enter each digit. findNumbers - finds numbers in text. PhoneNumberOfflineGeocoder - provides geographical information related to a phone number. PhoneNumberToCarrierMapper - provides carrier information related to a phone number. PhoneNumberToTimeZonesMapper - provides timezone information related to a phone number. Demo Java The Java demo is updated with a slight delay after the GitHub release. Last demo update: v9.0.42. Note: Even though the library (main branch/maven release) is at v8.12.57, because of some deployment issues, we were unable to update the Java demo with the new binary version. We will soon fix this. Meantime, please use JS demo. If this number is lower than the latest release's version number, we are between releases and the demo may be at either version. Demo App There is a demo Android App called E.164 Formatter in this repository. The purpose of this App is to show an example of how the library can be used in a real-life situation, in this case specifically in an Android App using Java. JavaScript The JavaScript demo may be run at various tags; this link will take you to master. Java code To include the Java code in your application, either integrate with Maven (see wiki) or download the latest jars from the Maven repository. Javadoc Javadoc is automatically updated to reflect the latest release at https://javadoc.io/doc/com.googlecode.libphonenumber/libphonenumber/. Versioning and Announcements We generally choose the release number following these guidelines. If any of the changes pushed to master since the last release are incompatible with the intent / specification of an existing libphonenumber API or may cause libphonenumber (Java, C++, or JS) clients to have to change their code to keep building, we publish a major release. For example, if the last release were 7.7.3, the new one would be 8.0.0. If any of those changes enable clients to update their code to take advantage of new functionality, and if clients would have to roll-back these changes in the event that the release was marked as "bad", we publish a minor release. For example, we'd go from 7.7.3 to 7.8.0. Otherwise, including when a release contains only metadata changes, we publish a sub-minor release, e.g. 7.7.3 to 7.7.4. Sometimes we make internal changes to the code or metadata that, while not affecting compatibility for clients, could affect compatibility for porters of the library. For such changes we make announcements to libphonenumber-discuss. Such changes are not reflected in the version number, and we would publish a sub-minor release if there were no other changes. Want to get notified of new releases? During most of the year, excepting holidays and extenuating circumstances, we release fortnightly. We update release tags and document detailed release notes. We also send an announcement to libphonenumber-discuss for every release. Quick Examples Let's say you have a string representing a phone number from Switzerland. This is how you parse/normalize it into a PhoneNumber object: String swissNumberStr = "044 668 18 00"; PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance(); try { PhoneNumber swissNumberProto = phoneUtil.parse(swissNumberStr, "CH"); } catch (NumberParseException e) { System.err.println("NumberParseException was thrown: " + e.toString()); } At this point, swissNumberProto contains: { "country_code": 41, "national_number": 446681800 } PhoneNumber is a class that was originally auto-generated from phonenumber.proto with necessary modifications for efficiency. For details on the meaning of each field, refer to resources/phonenumber.proto. Now let us validate whether the number is valid: boolean isValid = phoneUtil.isValidNumber(swissNumberProto); // returns true There are a few formats supported by the formatting method, as illustrated below: // Produces "+41 44 668 18 00" System.out.println(phoneUtil.format(swissNumberProto, PhoneNumberFormat.INTERNATIONAL)); // Produces "044 668 18 00" System.out.println(phoneUtil.format(swissNumberProto, PhoneNumberFormat.NATIONAL)); // Produces "+41446681800" System.out.println(phoneUtil.format(swissNumberProto, PhoneNumberFormat.E164)); You could also choose to format the number in the way it is dialed from another country: // Produces "011 41 44 668 1800", the number when it is dialed in the United States. System.out.println(phoneUtil.formatOutOfCountryCallingNumber(swissNumberProto, "US")); Formatting Phone Numbers 'a
Read the full README on GitHub

What Hacker News says

44 sources
The rationale of that falsehood¹ addresses that point: >> It wasn't even that long ago that mobile phones didn't exist, and it was common for an entire household to share one fixed-line telephone number. In some parts of the world, this is still true, and relatives (or even friends) share a single phone number. Many phone services (especially for businesses) allow multiple inbound calls to or outbound calls from the same phone number. ---- ¹ https://github.com/google/libphonenumber/blob/master/FALSEHO...
In YouTube asks channel owner to verify phone, permanently overwrites personal info
> the new SSNs - unique identifiers that never change and connect you across services And just like SSNs both the "unique" and the "never change" are only true of the spherical cow version of the system. Phone numbers are actually substantially worse at being unique and unchanging, what with people in families sharing a phone or trading phone numbers, people forgetting to transfer the number when switching carriers, people intentionally switching numbers in an attempt to end spam calls... The number of ways to break the assumed invariants is actually quite high. See Falsehoods Programmers Believe About Phone Numbers [0]. [0] https://github.com/google/libphonenumber/blob/master/FALSEHO...
In Second factor SMS: Worse than its reputation
This makes the assumption that Twitter blocked it due to SMS fraud. While that's a plausible theory an equally plausible theory is that they were worried about account hijacking and security (and allowed twitter blue subscribers to continue to use it on a you can pay me to be stupid context) which seems equally plausible. I take issue with a lot of the assumptions in the article but this is funny: > Identify and block premium rate phone numbers, using libphonenumber. Whilst this seems promising, I don’t know how reliable the data and how effective this approach is. here's this purpose-built and well maintained* library from google which does exactly what I want but i'm not even going to consider it. * the actual number database has been updated 5x so far this year: https://github.com/google/libphonenumber/commits/master/meta...
In How SMS fraud works and how to guard against it

Showing the 15 most recent of 44 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.