To send SMS or check a mobile number with CaptainVerify, every number in your database has to be written in a format that all carriers understand. That format is called E.164. Its main rule fits on one line. Its exceptions are what break imports.

Step 1: the country code

Every number starts with the country code, also called the international dialling code. It runs from 1 to 3 digits: 1 for the United States and Canada, 44 for the United Kingdom, 33 for France, 49 for Germany. The full list is in our table of calling codes by country.

Under E.164, that code is always written with a "+" in front of it.

The "011" you dial from a US phone reaches the same place, but it belongs to the network you are calling from. Every country has its own: 011 in the United States and Canada, 00 across Europe, 0011 in Australia. A number stored as 0033611223344 forces every recipient to translate a local convention. The "+" reads the same everywhere. Keep it in your columns.

Step 2: the E.164 standard

E.164 is the International Telecommunication Union recommendation that sets how a number is written so it stays routable from any network. It covers calls and SMS alike.

The number is written as one block, with the "+" then the digits. And it stops at 15 digits, country code included, the "+" excluded.

What a number looks like in E.164

Take 06 11 22 33 44, a French mobile.

  • Country code: 33
  • National number: 06 11 22 33 44
  • The leading 0 disappears once the country code is added
  • Result: +33611223344

That leading 0 is a trunk prefix, used inside the country and dropped internationally. North American numbers have no trunk prefix to drop, so a New York line goes straight from 212 555 1234 to +12125551234.

The mistakes that break a conversion

  • Spaces, dots, dashes and brackets stay in the database. +33 6 11 22 33 44 has to become +33611223344.
  • The trunk prefix survives the country code. A +330611223344 gets rejected by the carrier.
  • The 00 stays in front of the country code. Write +33, never 0033 or 00+33.
  • Italy keeps the leading 0 on its landlines. A Rome landline becomes +390612345678. Drop that 0 and the number stops existing. Italian mobiles sit outside the rule, since they already start with 3.
  • Excel eats the "+" or flips the number into scientific notation. Format the column as text before importing, otherwise 33611223344 shows up as 3.36112E+10.

Validating a number with a regular expression

Once the number is converted, a regular expression checks its shape. In PHP: preg_match('/^\+[1-9]\d{1,14}$/', $number). It accepts a "+", a first digit between 1 and 9, then 1 to 14 more digits.

For French mobiles, plenty of guides suggest ^\+33[67]\d{8}$. That version casts too wide a net. In the libphonenumber metadata only 073 through 079 count as mobile, which leaves 070 to 072 out. The genuinely mobile range is ^\+33(?:6(?:[0-24-8]\d|3[0-8]|9[589])|7[3-9]\d)\d{6}$.

Across a multi-country list, every country carries its own lengths and prefixes. That table becomes unmanageable by hand. Google publishes libphonenumber in Java, C++ and JavaScript, while the PHP and Python ports are community maintained. On an SMS campaign, a 070 number let through by mistake still ships with the batch and still gets billed.

A regular expression validates a shape. It says nothing about what sits at the end of the line.

A well-formatted number can still be unreachable

A number that follows E.164 is routable. It can still have been disconnected 3 years ago, or ported to another carrier.

The HLR Lookup queries the carrier register and returns the real state of the line, live or switched off, along with the operator running it today. On a list collected online, that check strips out the dead numbers before the SMS campaign bills them.

For companies with customers abroad, converting the whole database to international format decides whether marketing and transactional SMS arrive at all.

Convert your numbers to E.164

Paste up to 100 numbers, one per line, mixed or not. Any number that carries its own country code is recognised on its own, across 215 countries. A line the tool cannot convert comes back untouched, in place, so you can find it again.

Register now to keep a good reputation
100 free email credits