Phone Number Formatter

Parse and format phone numbers into international, national, and E.164 formats. Auto-detects country from prefix with validation.

Phone numbers come in dozens of formats - with or without country codes, parentheses, dashes, spaces, or dots. This formatter parses raw phone numbers and outputs them in three standard formats: International (+44 20 7946 0958), National (020 7946 0958), and E.164 (+442079460958). It auto-detects the country from the prefix and validates the number length. All processing runs in your browser.

Ad
Ad

About Phone Number Formatter

Output Formats Explained

FormatExample (UK)Example (US)When to Use
International+44 20 7946 0958+1 (212) 555-0123Displaying to users, especially in international contexts
National020 7946 0958(212) 555-0123Displaying to users within the same country
E.164+442079460958+12125550123Database storage, APIs, SMS services (Twilio, AWS SNS)

E.164 is the ITU-T recommendation for international phone number formatting. It starts with +, followed by the country code and subscriber number, with no spaces or formatting. This is the format that Twilio, AWS SNS, WhatsApp Business API, and most telephony services require.

Common Country Codes

CountryCodeNational Format ExampleSubscriber Digits
United States / Canada+1(212) 555-012310 (area + subscriber)
United Kingdom+44020 7946 095810 (area + subscriber)
Germany+49030 123456710-11 (variable)
France+3301 23 45 67 899
Australia+6102 1234 56789
India+9198765 4321010
Japan+8103-1234-567810 (variable)
Brazil+55(11) 91234-567810-11
China+86138 1234 567811 (mobile)

Why Phone Number Formatting Matters

ProblemCauseSolution
SMS delivery failsNumber stored without country code or with wrong formatStore as E.164 - always includes country code
Duplicate contacts in CRMSame number stored as "020 7946 0958" and "+44 20 7946 0958"Normalize to E.164 before comparison
International calls failLocal format used when dialling from abroadDisplay in international format with + prefix
Validation rejects valid numbersRegex expects specific format like (xxx) xxx-xxxxParse to E.164 first, then validate length for the country
Sorting is incorrectMixed formats sort lexically in unexpected orderStore and sort by E.164 (pure numeric with +)

UK Phone Number Types

Ofcom assigns UK numbers in blocks by leading digits, and the same subscriber number formats differently depending on which block it sits in.

Number RangeTypeNational FormatE.164 Format
020London landline020 7946 0958+442079460958
01xxxRegional landline0161 496 0000+441614960000
07Mobile07700 900000+447700900000
03Non-geographic0345 300 0000+443453000000
08Freephone / premium0800 000 0000+448000000000

The leading 0 in UK national format numbers is a trunk prefix - it is dropped when adding the country code (+44). So 07700 900000 becomes +44 7700 900000, not +44 07700 900000. Ofcom reserves the 07700 900000-900999 and 01632 960000-960999 ranges for drama and fiction, so none of the example numbers above will ever ring a real subscriber.

Worked Example: Normalising a Mixed List

A CRM import often contains the same person entered three different ways. Take these four strings:

Raw InputDetected CountryE.164 Output
(212) 555-0123US (manual select)+12125550123
+1 212.555.0123US (auto from +1)+12125550123
00 1 212 555 0123US (00 IDD prefix stripped)+12125550123
212-555-0123US (manual select)+12125550123

All four collapse to the same E.164 value +12125550123. If you deduplicate on that column you catch every duplicate in one pass. If you deduplicate on the raw string column you catch none. This is the single most common phone data hygiene mistake in customer databases, and on large consumer lists normalising to E.164 before a name-and-address fuzzy match routinely removes the majority of soft duplicates with no fuzzy logic at all.

Special Number Ranges to Handle With Care

Not every valid phone number is safe to autodial or to SMS. Most numbering authorities carve out reserved ranges for fiction, testing, and premium services, and billing mistakes on these can cost serious money.

RangeCountryPurpose
555-0100 to 555-0199US/Canada (NANP)Reserved for fictional use in film and TV
07700 900000-900999UKOfcom drama range, never rings a real subscriber
0900-0909UKPremium rate, up to GBP 3.60/minute plus network charge
+1-900USPremium rate, billed via the carrier
+882, +883GlobalInternational Networks - satellite, inmarsat, iridium
+881GlobalGlobal mobile satellite (GMSS)

What Is E.164 and Why Does It Matter?

E.164 is the ITU-T numbering plan defined in Recommendation E.164 (most recent revision November 2010, reaffirmed 2022). It caps the total international number at 15 digits excluding the leading +. The country code is 1-3 digits, and the remaining 12-14 digits are the national significant number. Twilio, AWS SNS, Vonage, MessageBird, WhatsApp Business, Apple Push for SMS routing, and the Google Phone Number API all require E.164 on input. Storing numbers in any other format means writing a conversion function every time you call these services, and those functions quietly drift out of sync.

Common Parsing Pitfalls

PitfallExampleCorrect Handling
Trunk prefix not stripped+44 020 7946 0958Drop the UK trunk 0 to get +442079460958
IDD 00 treated as country code00447700900000Replace leading 00 with + (most of Europe uses 00 as international access)
011 IDD prefix in North America0114420794960958Replace leading 011 with + when dialling from NANP
Letters in vanity numbers1-800-FLOWERSMap A-C=2, D-F=3... Z=9 using the ITU-T E.161 keypad before parsing
Extension appended+1 212 555 0123 x404Parse the E.164 part separately, store the extension in its own column
Leading + typed as %2B%2B447700900000 (URL-encoded)URL-decode before parsing; see the URL Encoder / Decoder

North American Numbering Plan (NANP)

The US, Canada, and 20 Caribbean nations all share country code +1 and use the same 10-digit format: NPA-NXX-XXXX (area code + exchange + subscriber). Common formatting variations:

FormatExampleCommon In
(NPA) NXX-XXXX(212) 555-0123Traditional US/Canadian format
NPA-NXX-XXXX212-555-0123Alternative US format
NPA.NXX.XXXX212.555.0123Some business cards and websites
+1 NPA NXX XXXX+1 212 555 0123International display
+1NPANXXXXXX+12125550123E.164 for APIs

NANP also restricts the first digit of each group: the NPA cannot start with 0 or 1, and neither can the NXX. The 555 prefix inside NXX (555-0100 through 555-0199) is reserved for fictional use, which is why Hollywood uses it.

Storing Phone Numbers in Databases

ApproachProsCons
E.164 string (VARCHAR 15)Universal, unambiguous, sortableNot human-readable
Separate country code + national numberEasy to format for different countriesTwo columns, need to join for API calls
Digits only (no + prefix)Numeric, easy to indexAmbiguous without country code - US and UK 10-digit numbers are different countries
Formatted stringHuman-readableInconsistent, hard to compare, wastes space

The recommended approach is to store E.164 in a VARCHAR(15) column (the maximum E.164 length is 15 digits including country code) and format it for display using a library like Google libphonenumber. Postgres users can reach for the phone_number extension; MySQL 8 has no native type but a generated column that strips non-digits works well as a secondary index. Never store the + in a numeric column - it forces a VARCHAR anyway and you lose the plus in SQL dumps rendered as integers.

libphonenumber vs. Regex Validation

A regex like /^\+?[1-9]\d{1,14}$/ catches the shape of an E.164 but tells you nothing about whether the number is dialable. Google's libphonenumber (ported to Java, JavaScript, Python, C++, Ruby, Go, PHP, Swift, and Objective-C) ships with the Ofcom-style block rules for every country and is updated roughly every two weeks against the latest numbering plans. For production systems handling SMS or voice, use libphonenumber. This formatter implements a lighter subset - good enough for CRM cleanup and manual data entry, not a substitute for full dial-plan validation before billing.

Mobile vs. Landline Detection

Knowing whether a number is a mobile matters because SMS only reaches mobiles and per-message pricing sometimes differs by line type. Detection is purely based on the number prefix within the country - there is no global rule. In the UK, any national number beginning 07 is a mobile; in France it is 06 and 07; in Germany it is 015, 016, or 017; in Japan it is 070, 080, or 090; in India every mobile starts with a 6, 7, 8, or 9. The NANP is the hard case: +1 has no dedicated mobile block, and number portability means a number that was issued as a landline in 2003 could be a mobile today. HLR lookups (via carriers like Telnyx or Twilio) are the only reliable way to get line type for NANP numbers, and they cost roughly $0.004 per query.

When to Reformat and When to Leave Alone

A good rule: reformat aggressively on input, display the user's own number back in their local format, and store E.164 everywhere in between. If a UK visitor types 07700 900000, the signup form should silently normalise to +447700900000 for storage, then render back as 07700 900000 on the profile screen because that is the format the user recognises. SMS gateways only see the stored E.164 value. Export tools and admin consoles should display E.164 directly so support staff can paste numbers between systems without translation. The Regex Tester is useful for sanity-checking any parsing patterns you write around this flow.

For similar normalization with email addresses, the Email Normalizer strips dots, aliases, and case differences. For validating structured data, the Credit Card Validator checks card numbers with the Luhn algorithm. All processing runs entirely in your browser.

Sources

Frequently Asked Questions

What phone number formats does this support?

It outputs three formats: International (+44 20 7946 0958), National (020 7946 0958), and E.164 (+442079460958). E.164 is the standard used by most APIs and databases.

How does country detection work?

The tool checks the leading digits against known country calling codes. Enter a number with a + prefix and it identifies the country automatically. You can also select a country manually from the dropdown.

Does it validate phone numbers?

It checks that the number has a valid country code and a reasonable length for that country. It flags obviously invalid numbers but cannot confirm a number is actually in service.

What countries are supported?

Over 30 common countries are included, covering North America, Europe, Asia-Pacific, and more. Each has its own formatting rules and expected length.

Can I format multiple numbers at once?

Enter one number at a time for detailed formatting and validation. For bulk processing, paste numbers one per line and the tool formats each one.

Link to this tool

Copy this HTML to link to this tool from your website or blog.

<a href="https://toolboxkit.io/tools/phone-formatter/" title="Phone Number Formatter - Free Online Tool">Try Phone Number Formatter on ToolboxKit.io</a>