Need help with libphonenumber?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

518 Stars 88 Forks MIT License 109 Commits 27 Opened issues


golang port of Google's libphonenumber

Services available


Need anything else?

Contributors list


golang port of Google's libphonenumber


Build Status GoDoc


This library is fully stable and is used in production by several companies.


Super simple to use.

To get a phone number

num, err := libphonenumber.Parse("6502530000", "US")

To format a number

// num is a *libphonenumber.PhoneNumber
formattedNum := libphonenumber.Format(num, libphonenumber.NATIONAL)

To get the area code of a number

// Parse the number.
num, err := libphonenumber.Parse("1234567890", "US")
if err != nil {
        // Handle error appropriately.

// Get the cleaned number and the length of the area code. natSigNumber := libphonenumber.GetNationalSignificantNumber(num) geoCodeLength := libphonenumber.GetLengthOfGeographicalAreaCode(num)

// Extract the area code. areaCode := "" if geoCodeLength > 0 { areaCode = natSigNumber[0:geoCodeLength] } fmt.Println(areaCode)

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.