Phone numbers are frequently used data types. So you would think they would be straightforward to work with, right? Right?
Well if you have phone numbers from multiple people and countries, it gets to be a mess.
You may find yourself having a spreadsheet with a bunch of different phone numbers and you’re stuck figuring out how to clean them.
If you want a quick way to do it, check out Clean Spreadsheets!
However, if you are trying to code or manually clean them yourself here is what you need to keep in mind.
What would cleaning a phone number do?
Cleaning a phone number will allow you to determine whether the number is valid and separate it into its components such as country code, area code and subscriber number.
Isn’t that straightforward?
You would think so but with different countries having different conventions, it gets out of hand quickly.
To limit this article getting too long, we will only be looking at the G20 countries. The top 19 largest economies of the world plus all the countries in the European Union.
Each country in the world (and some territories) has a 1, 2 or 3 digit country code. This is prefixed with a plus sign (+).
The official E.123 guide recommends including the country code when storing numbers for international calling. However, when dialing within the country it is not required.
The country code (if it appears) will be at the beginning and most likely separated from the rest of the phone number
Rest of the Phone Number
Outside of the country code, phone number conventions differ from country to country.
Let’s take a look at each one of the G20 countries.
Starting off, the United States and 24 other countries/territories share the North American Numbering Plan (NANP) with the format:
There is a 3 digit area code (AAA) followed by the 7 digit subscriber number. The N can only include numbers from 2 to 9.
The countries part of the NANP are: American Samoa, Anguilla, Antigua and Barbuda, Bahamas, Barbados, Bermuda, British Virgin Islands, Canada, Cayman Island, Dominica, Dominican Republic, Grenada, Guam, Jamaica, Montserrat, Northern Mariana Islands, Puerto Rico, Saint Kitts and Nevis, Saint Lucia, Saint Vincent and the Grenadines, Sint Maarten, Trinidad and Tobago, Turks and Caicos Islands, and United States Virgin Islands
The country code for the United States is +1.
In Mexico, numbers are 10 digits long and the first number will be from 2–9. The area code can be 2 or 3 digits, followed by an 8 or 7 digit local number.
The format is:
- AA NNNN XXXX or (AA) NNNN XXXX
- AAA NNN XXXX or (AAA) NNN XXXX
The country code is +52.
Phone numbers in Argentina have 11 digits.The area code always starts with 0 but can be 3–5 digits.
Phone numbers are usually formatted as:
- (0AA) NNNN-XXXX
- (0AAA) NNN-XXXX
- (0AAAA) NN-XXXX
+54 is the country code and it replaces the 0.
All landline phones are 10 digit numbers with the format:
- AA NXXX-XXXX (N is a digit from 2 to 5)
Meanwhile, all mobile phones are 11 digit numbers following the format:
- AA NXXXX -XXXX (N is a digit from 6 to 9)
The country code is +55 added in front of the number.
For local calls it starts off with the trunk prefix 0, a 2 digit area code and 7 remaining digits for the subscriber number. For international calls there is a +27 instead of the 0.
- 0AA XXX XXXX
- +27 AA XXX XXXX
Numbers can be 10 or 11 digits depending on area or type of phone.
- 0AAA NNNN XXXX
The area code can be 2 or 3 digits and the local number can be 7 or 8 digits depending on the area.
11 digit number following the format 1WX NNNN XXXX
WX is the service provider and W is always a number from 3–9
NNNN is the HLR code to determine the area and XXXX is the subscriber number.
The 0 is dropped and +86 is added
Phone numbers are 10 digits, excluding a 0 that’s required at all times. Numbers also fall into a few categories:
AAA is the Subscriber Trunk Dialing code or the long distance code and it can be 2–4 digits long. NNNNNNN is the phone number.
Non-local calls need to be prefixed by 0 or +91 which works for all of India and international.
Japan is similar to what we see in North America but there is a trunk code of 0 and international code of +81.
Some areas have a longer or shorter area code but the common format is:
- 0AA NNN-XXXX
Republic of Korea
Phone numbers can be 7–11 digits long depending on if you’re making a local call where the area code isn’t required.
The area codes can be 2–3 digits depending on the city but the format is:
- 0AA-NNN-XXXX or
- (0AA) NNN-XXXX or
- 0AA NNN XXXX
For mobile phones it’s an 8 digit subscriber number and 01 and the area code in the beginning:
The country code is +82 and replaces the 0 when calling internationally.
Landlines use area codes while mobile phones do not.
Phones starts with a 0 when making domestic calls and +62 internationally. Numbers are 7 or 8 digits long.
- AA NNNN-XXXX
Numbers are 8–12 digits long and include a trunk prefix of 0, followed by 8NNN which is the mobile prefix.
- 0 8NNN XXX XXXX
The phone number is 7 digits and there is a 3 to 5 digit area code including a trunk prefix of 0. The international code is +966 that replaces the 0.
- 0AA NNN XXXX
Numbers are 10 digits and written as
- (0A) NNNN XXXX with +61 for international calls
For local calls the area code is optional.
Numbers have a trunk prefix of 0 and the country code is +90 for calling internationally. The 0 is dropped when making calls outside of Turkey.
The common format for Turkish numbers is
- 0AAA NNN XX NN
Landlines can have the prefix 02, 03, or 04
While mobile numbers have 05
Austria and a few other countries are part of the Open Numbering Plan so there is no standard length to the area code or subscriber number, but will range from 4–13 digits in total.
The international code is +43.
- 1 NNN XXXX
Phone numbers start with the number 6 and the format can be:
- 6AA NNN XXXX
Numbers are 8 or 9 digits in length, with an additional area code and have a trunk prefix of 0 or the country code of +359.
- 0A NNN XXXX
- 0AAA NNN XXXX
Phone numbers will start with a 0 and the “zone prefix” which can be 1–2 digits for landlines and 3 digits for mobile phones.
Depending on the zone prefix numbers can be written as
- 0AA NN NN NN or
- 0A NNN NN NN
The first digit of the zone prefix is always 4 and the format can be written as:
- 04AA NN NN NN
Numbers can sometimes have a slash or dots between the zone prefix and subscriber’s number such as
- 04AA/NN NN NN or
- 04AA/NN.NN.NN or
The international code prefix is +32 and drops the 0.
The typical format is pretty to similar to some we have seen before. Numbers are usually 10 digits including a trunk prefix of 0.
- (0AA) NNN XXXX
The area code in unnecessary to dial if you’re in the same area.
The country code is +385
Numbers start with a 2 and have the format:
Numbers start with 9 but have the same format:
The international code is +357 that gets added in front of the number.
The typical format is 9 digits such as AAA NNN XXX and the international code is +420.
Numbers are 8 digits long and have no area code. The international code is +45 and common formats are:
- NN NN NN NN
- NNNN XXXX
Estonia has an open numbering plan and numbers are typically 7 to 12 digits. There are no area codes and the typical formats are:
- NNN XXXX
- NNNN XXXX
The country code is +372
This is another country with an open numbering plan and numbers can be 5 to 12 digits with a trunk prefix of 0 and an international code of +358 that will replace the 0.
All landlines start with 09 and have the format:
- 09A NNNN XXXX
Numbers can start with 04 or 05 depending on the mobile carrier, such as:
- 04A NNN XXXX
There are 10 digit numbers and be written as
- 0A NN NN NN NN or
The area code is a number between 1–5
For international calls the format drops the 0 and adds +33
Germany has an open number plan but are usually 10–12 digits long, with a trunk prefix of 0. The country code is +49 and replaces the 0.
A common format is:
- (0AA) NNNN-XXXX
Phone numbers are usually 10 digits long but the area code is 2 or 3 digits and written as:
- AAN XXXXXXX or
- AAAN XXXXXX
The international code is +30 and goes in front of the number.
Area codes are 2 digits and the subscribers number is 6 digits long. Cell phone numbers and phone numbers from Budapest are 7 digits in total. The country code is +36.
Ireland also has an open numbering plan.
Area codes start with the trunk prefix 0 and can be 2 to 4 digits, followed by a local phone number being 7 digits.
Local numbers can be formatted as:
- 5 digit numbers: NNNNN
- 6-digit number: NNN XXX
- 7-digit number: NNN XXXX
Hyphens are generally discouraged and mobile numbers are usually formatted as:
- 08A NNN XXXX
The country code is +353
Another country with open telephone numbering plan but numbers can range from 6–11 digits.
The country code is +39.
Phones start with 0 followed by a prefix area code. An example of the format is:
- 0A NNNXXXX
Numbers start with 3 and are usually 10 digits long following the format:
- 3AA NNNXXXX
The country code is +361
Phones all start with a 2 and have the format:
- 2AA NN XXX
Landline numbers can start with a 5, 6, or 7 and follow the format:
- 5 AA NNXXX
Area codes are 2 to 5 digits depending on the size of the town or city, and are followed by a national or local number that is 8 digits.
Every number starts with 8.
The country code is +370
Some common formats can include:
- (8A) NNN XXXX
- (8AA) NN XXXX
Mobile phones have a 3-digit network code followed by 6 digit subscriber number such as:
- 6X1 NNN XXX
Mobile numbers always starts with a 6 and the country code is +352
There is a prefix of 21 and the international code is +356, such as:
- 21XX NNNN
Phones have a prefix 99, 79, etc depending on the mobile carrier
- 99XX NNNN
Numbers are 10 digits with a trunk prefix of ‘0’.
- 0AA-NNNNNNN or
Phones have a 1 digit area code of 6, and 8 digits of the subscriber’s number:
N is never a 6 or 7
The country code is +31 and replaces the 0
Phone numbers are 9 digit numbers long and the country code is +48, which goes in front of the number.
- AA-NNN-XX-NN or
Similar to Poland the numbers are 9 digits and written as AAA AAA AAA
All mobile numbers start with 9 and the country code is +351 that just goes in front of the number.
Phone numbers are 10 digits long, not including the trunk prefix 0.
Mobile and landline phones both follow the same format of:
The country code is +40 and goes in front of the number.
As we have seen before, it is common for some European countries to have an open numbering plan.
In Russia, numbers are 10 digits and the trunk prefix is 8.
Area codes vary by regions but are 3–5 digits and subscriber number is separated by dashes.
The common format is
- 8 (AAA) NNN-NN-XX
For international callers, the country code is +7
Numbers are 9 digits and start with 9 or 8 for landlines and 6 or 7 for mobile phones.
Numbers can be written as
- AA NNN XX NN or
- AAA NNN XXX depending on the length of the area code.
The country code is +34 and goes in front of the number.
All numbers are 9 digits, including a trunk prefix of 0.
The country code is +386 and replaces the 0.
The area code can be 1–3 digits and possible formats are:
- (0A) NNN XX XX or
- (0AA) NNN XXX or
- (0AAA) NN XXX
Sweden has an open numbering plan so number formats vary by length but have a trunk prefix of 0. The country code is +46 and replaces the 0 when calling internationally.
10 Digit Number
- 0A-NNN XXX XX or
- 0AA-NNN XX XX or
- 0AAA-NN XX XX
- 0A-NNN XX XX or
- 0AA-NNN XX XX or
- 0AAA-NNN XX
- 0A-NN XX XX or
- 0AA-NNN XX
Numbers are 10 Digits and always start with 7. Such as:
- 07A-NNN XX XX or
- 07AA-NN XX XX
The length of numbers ranges from 7 to 10 digits since there is an open numbering plan.
The trunk prefix is 0 and country code is +44, which replaces the 0 when calling from outside the U.K.
A common format is:
- (0AAA) NNN XXXX
Mobile phones start with 7 and vary by cell phone provider but a common format is:
- 07AAA NNN XXX
You can use this guide to come up with an implementation to clean phone numbers from your database, programming language or spreadsheets.
And if you need to clean numbers in spreadsheets, you can check out our tool Clean Spreadsheets to automatically clean and transform any phone numbers in your spreadsheets.
Happy Data Cleaning!