Phone
Test a phone number against libphonenumber metadata
See what Google's libphonenumber metadata says about a number: isValid, isPossible, type, region, every format and a JavaScript snippet that reproduces it.
Runs in your browserNothing you paste or open here leaves this page. No account, no daily limit.
The length and the leading digits match a range the numbering plan uses.
- isValid
- true
- isPossible
- true
- Type
- MOBILE
- Region
- GB
- Country calling code
- +44
- National significant number
- 7400123456
- Extension
- None
- Possible countries
- GB
- Non-geographic
- false
- E.164
- +447400123456
- International
- +44 7400 123456
- National
- 07400 123456
- RFC 3966
- tel:+447400123456
- From the US
- 011 44 7400 123456
- From the UK
- 07400 123456
JavaScript snippet
import { parsePhoneNumberFromString } from 'libphonenumber-js/max'
const phone = parsePhoneNumberFromString('+44 7400 123456')
phone.isValid() // true
phone.getType() // 'MOBILE'
phone.country // 'GB'
phone.number // '+447400123456'
phone.formatNational() // '07400 123456'- API access
- Unlock with a free account
How to read the result
The playground parses one number with a default country, then shows what libphonenumber's metadata says about it: the checks, the parts of the number, every format, and a snippet to reproduce it.
| Field | What it means | What to do with it |
|---|---|---|
| isValid | true when the length fits and the digits fall in a range of the country's plan. |
The answer to "is this a real number in its plan". |
| isPossible | true when the length fits some kind of number in that country. Digits are not checked. |
Use it for quick feedback while someone types, never as the final check. |
| Type | The libphonenumber type: FIXED_LINE, MOBILE, FIXED_LINE_OR_MOBILE, TOLL_FREE, PREMIUM_RATE, SHARED_COST, VOIP, PERSONAL_NUMBER, PAGER, UAN, VOICEMAIL. Empty for an invalid number. | Decide whether to text, call or refuse it. |
| Region | The ISO 3166-1 alpha-2 code of the country or territory, such as GB or GG. | Empty for non-geographic numbers such as +800. |
| Country calling code | The code after the plus sign, such as 44. | Several regions can share it. |
| National significant number | The digits after the calling code, without trunk prefix, such as 7400123456. | Store E.164 instead. This is its second half. |
| Extension | The extension, when you typed one with ext., x or #. | Keep it next to the number. E.164 has no room for it. |
| Possible countries | The regions the number could belong to under its calling code. | More than one means the digits did not settle it. |
| E.164 | The international form with + and no spaces, such as +447400123456. | The form to store and compare on. |
| International | With spaces, such as +44 7400 123456. | Print it, or show it to people abroad. |
| National | As written inside the country, such as 07400 123456. | Show it to local users. |
| RFC 3966 | A tel: URI, such as tel:+447400123456;ext=99. | Use it in links, so a tap starts a call. |
| From the US | How to dial it from the United States, such as 011 44 7400 123456. | Instructions for US callers. |
| From the UK | How to dial it from the United Kingdom, such as 00 44 7400 123456, or the national form for a UK number. | Instructions for UK callers. |
| JavaScript snippet | Code that reproduces the parse with libphonenumber-js. | Paste it into your project to compare results. |
| API access | Locked. Validation, region, time zones and carrier from your code. | Needs a free account. |
The formats appear for every possible number, valid or not: +1 123 456 7890 gets an E.164 form while isValid reads false. A format is not a validation. The playground runs in your browser, with no account and no daily limit.
How the playground works
- Parse. The input is read by libphonenumber-js with its
maxmetadata, the full set that holds every type pattern. A number that starts with + carries its country. Without a +, the default country you pick decides how the digits are read, including its trunk prefix and its international prefix. - Fill the gaps the way the API does. With no default country, a leading 00 is read like +. With a default country that shares its calling code with others, such as Jersey under +44, the number is placed in that country when it is valid there.
- Check. isPossible tests the length, isValid tests the length and the digit patterns, and the type comes from the type patterns the number matches. A number that matches both the fixed-line and the mobile patterns gets FIXED_LINE_OR_MOBILE.
- Format. E.164, international, national, RFC 3966 and the two out-of-country formats are produced from the metadata's formatting rules.
The metadata comes from Google's libphonenumber, whose maintainers follow the numbering plans that national regulators publish. The versions in use are on the data sources page. The site's phone validator and the phone API run the same parsing code.
Possible or valid: what each check catches
| Input | isPossible | isValid | Why |
|---|---|---|---|
| +44 7400 123456 | true | true | Right length, and 7400 is a UK mobile range. |
| +44 7400 1234 | false | false | Eight digits after +44 is too short for any UK number. |
| +1 123 456 7890 | true | false | Ten digits fits +1, but no area code starts with 1. |
| +1 211 555 0123 | true | false | 211 is an N11 code, used for dialing services, not an area code. |
| +33 7 00 00 00 00 | true | false | Nine digits fits France, but the plan uses no range starting 07 00. |
| +1 201 555 0123 | true | true | A valid range. 555-01XX numbers are fictional, yet the plan accepts them. |
isPossible is cheap and tolerant, which suits typing feedback. isValid is the check to store a number on. Neither says whether a line works.
Shared calling codes and possible countries
Some calling codes serve several regions, and libphonenumber picks the region from the leading digits of the national number.
| Input | Region | Type |
|---|---|---|
| +1 201 555 0123 | US | FIXED_LINE_OR_MOBILE |
| +1 242 357 1234 | BS, the Bahamas | MOBILE |
| +1 809 234 5678 | DO, the Dominican Republic | FIXED_LINE_OR_MOBILE |
| +44 7781 123456 | GG, Guernsey | MOBILE |
| +7 701 234 5678 | KZ, Kazakhstan | MOBILE |
| +262 692 12 34 56 | RE, Réunion | MOBILE |
When a number under a shared code is invalid, the region stays empty and possible countries lists every candidate: for +1 123 456 7890, that is every region of the North American plan, from the United States and Canada to Jamaica and Guam. Non-geographic codes have no region at all: +800 is the code of Universal International Freephone Numbers, defined by ITU-T: +800 1234 5678 is valid, of type TOLL_FREE, with no region.
From libphonenumber types to API line types
If you call the phone API next to the library, its line_type field uses lower-case names for the same types:
| libphonenumber getType() | API line_type |
Line type on the site |
|---|---|---|
| MOBILE | mobile |
Mobile |
| FIXED_LINE | landline |
Landline |
| FIXED_LINE_OR_MOBILE | fixed_line_or_mobile |
Landline or mobile |
| VOIP | voip |
VoIP |
| TOLL_FREE | toll_free |
Toll-free |
| PREMIUM_RATE | premium_rate |
Premium rate |
| SHARED_COST | shared_cost |
Shared cost |
| PERSONAL_NUMBER | personal_number |
Personal number |
| PAGER | pager |
Pager |
| UAN | uan |
Universal access number |
| VOICEMAIL | voicemail |
Voicemail |
| undefined | unknown |
Unknown |
The line type lookup explains what each type means for SMS and calls, with examples by country.
min, max and mobile metadata
libphonenumber-js lets you choose how much metadata to load, to keep bundles small. The choice changes results:
- min, the default import. It holds the lengths and formatting rules but not the digit patterns, so isValid behaves like isPossible, and getType returns undefined for most countries.
- max, imported from
libphonenumber-js/max. The full set: strict isValid and every type. Google's own library always works with the full metadata. This playground and its snippet use it. - mobile, imported from
libphonenumber-js/mobile. The full set restricted to mobile numbers: other types can come back as not valid or without a type.
If your form accepts numbers that this playground rejects, check the import first. A bare import ... from 'libphonenumber-js' loads min.
Reproduce the result in your code
The snippet under the result is ready to paste. For 0049 1512 3456789 with no default country, it reads:
import { parsePhoneNumberFromString } from 'libphonenumber-js/max'
const phone = parsePhoneNumberFromString('+4915123456789')
phone.isValid() // true
phone.getType() // 'MOBILE'
phone.country // 'DE'
phone.number // '+4915123456789'
phone.formatNational() // '01512 3456789'
Three details make the snippet match the playground:
- It imports from
libphonenumber-js/max, for the full metadata. - It passes your default country as the second argument when you chose one, such as
parsePhoneNumberFromString('(201) 555-0123', 'US'). - When you typed a number with 00 and no country, it writes the number with + instead, since the playground reads 00 that way.
parsePhoneNumberFromString returns undefined for input that is not a phone number, or a number without a country code when no default country is given. Check for it before calling methods.
Surprises worth knowing
- National formats keep local habits. A Russian mobile, +7 912 345 67 89, is written 8 (912) 345-67-89 nationally, with the trunk prefix 8. Japanese numbers use hyphens: +81 50 1234 5678 becomes 050-1234-5678.
- Some zeros are part of the number. Italian landlines keep their 0 after +39: +39 06 1234 5678. Do not strip it.
- Extensions survive parsing. +44 7400 123456 ext 99 is valid, with extension 99, a national form of 07400 123456 x99 and a URI of tel:+447400123456;ext=99.
- A default country can mislead. Local digits read with the wrong country can land in a valid range there. Try (201) 555-0123 with the United Kingdom as default: it parses as a London number.
- Plans change. Regulators open and close ranges, and each metadata release follows. A number valid today can be invalid in an old copy of the library, so update it regularly where you validate.
The phone number regex tester shows why patterns written by hand drift from these rules, and the phone number formatter covers the formats in more depth.
When to call the API instead
libphonenumber answers questions about the numbering plan. Some questions need data it does not have:
| Question | libphonenumber | Phone API |
|---|---|---|
| Valid in its plan? Type? Formats? | Yes | Yes, same code and metadata |
| State, region or city of the range | Not in libphonenumber-js | Yes, from Google's geocoding files and the NANPA area code report |
| Time zones of the range | Not in libphonenumber-js | Yes, from Google's time zone file |
| Operator the range was assigned to | Not in libphonenumber-js | Yes, at the basic level, for 1 credit |
| Carrier serving the number today | No | Yes, at the live level, for 3 credits |
| Ported or not | No | Yes, at the live level |
| Consumer complaints to the FTC | No | Yes, through the phone spam reports endpoint |
Validating on your server also keeps one metadata version for every client, instead of whatever each browser cached. The phone API reference documents every field, the guide Validate signup forms shows where to call it, and a free account includes 100 credits a month. For a whole file of numbers, the phone list cleaner runs the same library in your browser.
Same check through the API
One HTTPS call, one credit. The response below is the real schema returned by the API.
curl https://api.qelka.com/v1/phone \
-H "Authorization: Bearer sk_test_your_key" \
-H "Content-Type: application/json" \
-d '{"phone":"+12015550123","level":"basic"}'const response = await fetch("https://api.qelka.com/v1/phone", {
method: "POST",
headers: {
Authorization: "Bearer sk_test_your_key",
"Content-Type": "application/json",
},
body: JSON.stringify({
phone: "+12015550123",
level: "basic",
}),
});
const result = await response.json();{
"id": "lkp_01M84QZDVBQCJAMBE4TJB6VRAC",
"object": "phone",
"input": "+12015550123",
"valid": true,
"status": "valid",
"e164": "+12015550123",
"national": "(201) 555-0123",
"country": {
"code": "US",
"name": "United States",
"calling_code": "1"
},
"region": "New Jersey",
"timezones": [
"America/New_York"
],
"line_type": "fixed_line_or_mobile",
"carrier": {
"name": null,
"mcc": null,
"mnc": null,
"source": "numbering_plan"
},
"ported": null,
"credits_used": 1,
"cached": false
}Bulk and pricing
- Upload a CSV of up to 2,000,000 rows from the dashboard or the API, pick the column, get the results back as a CSV.
- Every check costs 1 credit, live phone lookups cost 3. Cached results are billed the same way; calls that fail upstream are not billed.
- The free plan includes 100 credits every month. Paid plans start at $29 for 10,000 credits.
Frequently asked questions
What is libphonenumber?
What is the difference between libphonenumber and libphonenumber-js?
What is the difference between isPossible and isValid?
Why is a number valid here but invalid in my app, or the reverse?
Why does getType return undefined?
What does FIXED_LINE_OR_MOBILE mean?
What is the national significant number?
How do I parse a number written with 00 or 011 in front?
What are possible countries?
Does isValid mean the number is in service?
Is the number I type sent to a server?
How do I write a number for dialing from another country?
Which metadata version does the playground use?
Can libphonenumber tell me the carrier of a number?
Put this check in your product
Get an API key in under a minute. 100 free credits every month, no card required.
- 100 free credits a month
- No card
- Test keys spend nothing
- Cancel any time