Understand how phone number formats differ across countries. Learn about country codes, area codes, formatting conventions, and validation approaches.
The Complexity of Phone Numbers
Phone numbers look simple but are surprisingly complex when you consider international formats. A phone number valid in one country may be the wrong length, use the wrong format, or start with the wrong digits in another. For developers building global applications, handling phone numbers correctly is essential.
The International Standard: E.164
The ITU E.164 standard defines the international phone number format:
+[Country Code][Subscriber Number]
Maximum total length: 15 digits (including country code).
Example
+14155551234 (US)
+442071234567 (UK)
+81312345678 (Japan)
The E.164 format is the best way to store phone numbers in databases because it is unambiguous and globally unique.
Country Code Reference
Single-Digit Country Codes
+1 - United States, Canada, and Caribbean nations (NANP)
Two-Digit Country Codes
+44 - United Kingdom
+49 - Germany
+33 - France
+61 - Australia
+81 - Japan
+86 - China
+91 - India
+55 - Brazil
+82 - South Korea
+39 - Italy
Three-Digit Country Codes
+353 - Ireland
+354 - Iceland
+358 - Finland
+351 - Portugal
+852 - Hong Kong
+971 - UAE
Number Length by Country
Phone number lengths (excluding country code) vary significantly:
| Country | Digits (excluding country code) | Example |
|---------|------|---------|
| US/Canada | 10 | (415) 555-1234 |
| UK (landline) | 10-11 | 020 7123 4567 |
| UK (mobile) | 10 | 07911 123456 |
| Germany | 3-12 (varies) | 030 12345678 |
| France | 9 | 01 23 45 67 89 |
| Japan | 9-10 | 03-1234-5678 |
| Australia | 9 | 02 1234 5678 |
| India | 10 | 98765 43210 |
| Brazil | 10-11 | (11) 98765-4321 |
| China | 11 | 138 1234 5678 |
Note that Germany is particularly challenging because subscriber numbers can range from 3 to 12 digits.
Local Formatting Conventions
United States
(415) 555-1234 Standard display
415-555-1234 Alternative
415.555.1234 Dot-separated
+1 (415) 555-1234 With country code
United Kingdom
020 7123 4567 London landline
0161 234 5678 Manchester landline
07911 123456 Mobile
+44 20 7123 4567 International format
Note: The leading 0 (trunk prefix) is dropped when using the country code.
France
01 23 45 67 89 Domestic format (pairs of digits)
+33 1 23 45 67 89 International format
The leading 0 is dropped in international format.
Japan
03-1234-5678 Tokyo landline
090-1234-5678 Mobile
+81 3-1234-5678 International format
The leading 0 is dropped in international format.
Germany
030 12345678 Berlin landline
0151 12345678 Mobile
+49 30 12345678 International format
Trunk Prefixes
Many countries use a trunk prefix (usually 0) for domestic calls that is dropped in international format:
UK: 0 (020 becomes +44 20)
France: 0 (01 becomes +33 1)
Germany: 0 (030 becomes +49 30)
Japan: 0 (03 becomes +81 3)
Australia: 0 (02 becomes +61 2)
The US and Canada do not use a trunk prefix — the number is the same domestically and internationally (just add +1).
Validation Best Practices
Do Not Use a Single Regex
Phone number formats are too varied for one regex. Use a library like Google's libphonenumber, which handles validation for every country.
Accept Multiple Formats
Users enter phone numbers in many ways. Your system should accept all common variations and normalize to E.164 for storage:
Input: "(415) 555-1234" or "415-555-1234" or "4155551234"
Stored: "+14155551234"
Display in Local Format
When displaying a phone number back to the user, format it according to their country's convention, not the raw E.164 string.
Tips for Developers
**Store in E.164 format** - "+[country code][number]" with no spaces or punctuation
**Display in local format** - Use the user's country convention for readability
**Use libphonenumber** for validation and formatting — do not write your own parser
**Accept the trunk prefix or not** - Users may or may not include the leading 0
**Pair phone numbers with country** - You cannot validate without knowing the country
**Test with numbers from your target markets** using a phone/address generator