Phone Number Parser & Formatter

Parse international phone numbers, validate them, and reformat into E.164, international, or national forms.

Parse international phone numbers, validate them, and reformat into E.164, international, or national forms. Parse international phone numbers, validate them, and reformat into E.164, international, or national forms.

Background

How phone numbers are structured

An international phone number is made of three logical parts: a country calling code (1 for North America, 44 for the UK, 86 for China, 81 for Japan, and so on), a national significant number (area code plus subscriber number), and an optional extension. The E.164 recommendation defines the canonical representation: a leading +, the country code, then the national number with no separators -- for example +14155552671. When users type numbers in free form, they may include spaces, dashes, parentheses, or leading zeros that are meaningful only inside a country. A good parser normalizes all of that into structured fields.

Why parsing is harder than it looks

Countries disagree on almost everything: the length of national numbers, the use of trunk prefixes (China drops a leading 0 when dialing from abroad, the UK does the same with its trunk 0), mobile versus fixed prefixes, and special short codes. 4444 is a valid national number in some countries and invalid in others. Numbering plans are also moving targets -- Brazil added a digit to all mobile numbers in 2016, and every country's regulator publishes changes. That is why serious validators carry a full metadata database instead of hard-coded regexes. The library powering this page bundles the official Google metadata for every country and territory, so it knows, for example, that China mobile numbers are 11 digits and start with 1.

Using the parser

Type a number with or without the + and country code. If you omit the country code, pick a default country from the dropdown so the parser can resolve the national format. The tool reports the E.164 form, the international formatting with spaces, the national formatting, the detected country, the calling code, the national number, whether the number is valid and possible, the number type (mobile, fixed line, toll-free, etc.), and the carrier when the metadata can determine it. A number can be "possible" (the right length and prefix shape) without being "valid" (assigned and properly structured) -- both checks are shown.

Practical notes

Country detection from a bare number is heuristic: +1 555 2671 unambiguously means North America, but short numbers can match several countries. Always include the country code for machine-to-machine use, and store numbers in E.164 form in your database. When validating user input, prefer "possible" checks for instant UX feedback and reserve full "valid" checks for submission. This tool runs entirely in your browser on the bundled libphonenumber-js (MIT) data -- nothing you type is transmitted.

Built with the MIT-licensed libphonenumber-js library bundled in public/assets. Parsing is done locally in your browser.

Frequently asked questions

Why do I get 'possible but not valid'?
Possible means the number matches the country's general length and prefix shape. Valid means it is a genuinely assigned number under the official metadata. Many test numbers or unassigned ranges are possible but not valid.
What is E.164 and why store it?
E.164 is the ITU standard for phone numbers: + then country code then national number, max 15 digits. Storing this single canonical form makes deduplication and international dialing trivial, since it is unambiguous across all countries.
Can I validate numbers without a country code?
Not reliably. Without a country code the parser has to guess, and short numbers can be valid in many countries. Provide a default country (or require the code) whenever the input is not explicitly international.
How is the number type determined?
The bundled metadata classifies ranges by prefix: mobile, fixed line, toll-free, premium, VoIP, shared cost, and more. The type is shown only when the metadata assigns one; otherwise a dash appears.
Is my input sent anywhere?
No. Parsing, validation, and formatting all happen in your browser using the bundled libphonenumber-js package (MIT). The page works fully offline after it loads.
Why does the same number format differently in different countries?
International formatting groups digits by the country's own conventions (for example French numbers group in pairs, US numbers use 3-3-4). E.164 stays identical regardless; only the display form changes.