[{"data":1,"prerenderedAt":74},["ShallowReactive",2],{"content:en:blog\u002Fe164-format":3},{"path":4,"locale":5,"section":6,"title":7,"description":8,"html":9,"headings":10,"faq":49,"updated":71,"order":14,"words":72,"meta":73},"blog\u002Fe164-format","en","blog","E.164 format explained, with examples by country and how to store numbers","What the E.164 phone number format is, how to convert numbers from 12 countries, the trunk prefix traps, and how to store, index and display numbers.","\u003Cp>E.164 is the international phone number format defined by ITU-T Recommendation E.164: a plus sign, a country calling code of one to three digits, then the national number without its trunk prefix, with no spaces and 15 digits at most. \u003Ccode>+14155550123\u003C\u002Fcode> and \u003Ccode>+447400123456\u003C\u002Fcode> are E.164 numbers. Store every phone number in this form, keep the country beside it, and format it for people only when you display it.\u003C\u002Fp>\n\u003Ch2 id=\"what-an-e164-number-is-made-of\">What an E.164 number is made of\u003C\u002Fh2>\n\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Part\u003C\u002Fth>\n\u003Cth>In \u003Ccode>+447400123456\u003C\u002Fcode>\u003C\u002Fth>\n\u003Cth>Rule\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\n\u003Ctd>Plus sign\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Marks the number as international. It replaces whatever exit code the caller's country uses.\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Country calling code\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>44\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>One to three digits, assigned by the ITU. It never starts with 0.\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>National significant number\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>7400123456\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>The national number without its trunk prefix.\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Total length\u003C\u002Ftd>\n\u003Ctd>12 digits\u003C\u002Ftd>\n\u003Ctd>15 digits at most, plus sign not counted.\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\n\u003Cp>Strictly, E.164 defines the digits. The plus sign as the symbol for &quot;an international number follows&quot; comes from its companion recommendation, ITU-T E.123. In software, &quot;E.164 format&quot; means the two together, and that is the form SMS and voice APIs commonly expect.\u003C\u002Fp>\n\u003Cp>The shape is easy to check: \u003Ccode>^\\+[1-9]\\d{1,14}$\u003C\u002Fcode>. That pattern rejects spaces, missing plus signs and leading exit codes. It cannot tell you whether the number exists in its country. For that you need the numbering plan, which \u003Ca href=\"\u002Fblog\u002Fphone-number-validation\">phone number validation\u003C\u002Fa> covers.\u003C\u002Fp>\n\u003Ch2 id=\"e164-examples-by-country\">E.164 examples by country\u003C\u002Fh2>\n\u003Cp>Each country writes numbers its own way at home. The E.164 form removes those differences.\u003C\u002Fp>\n\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Country\u003C\u002Fth>\n\u003Cth>Calling code\u003C\u002Fth>\n\u003Cth>As written at home\u003C\u002Fth>\n\u003Cth>E.164\u003C\u002Fth>\n\u003Cth>What changed\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\n\u003Ctd>United States\u003C\u002Ftd>\n\u003Ctd>+1\u003C\u002Ftd>\n\u003Ctd>(415) 555-0123\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+14155550123\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Punctuation removed, \u003Ccode>+1\u003C\u002Fcode> added\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Canada\u003C\u002Ftd>\n\u003Ctd>+1\u003C\u002Ftd>\n\u003Ctd>(416) 555-0123\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+14165550123\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Same plan as the US\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>United Kingdom\u003C\u002Ftd>\n\u003Ctd>+44\u003C\u002Ftd>\n\u003Ctd>07400 123456\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+447400123456\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Trunk \u003Ccode>0\u003C\u002Fcode> dropped\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>United Kingdom\u003C\u002Ftd>\n\u003Ctd>+44\u003C\u002Ftd>\n\u003Ctd>0121 234 5678\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+441212345678\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Trunk \u003Ccode>0\u003C\u002Fcode> dropped\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>France\u003C\u002Ftd>\n\u003Ctd>+33\u003C\u002Ftd>\n\u003Ctd>06 12 34 56 78\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+33612345678\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Trunk \u003Ccode>0\u003C\u002Fcode> dropped\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Germany\u003C\u002Ftd>\n\u003Ctd>+49\u003C\u002Ftd>\n\u003Ctd>030 123456\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+4930123456\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Trunk \u003Ccode>0\u003C\u002Fcode> dropped; German numbers vary in length\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Germany\u003C\u002Ftd>\n\u003Ctd>+49\u003C\u002Ftd>\n\u003Ctd>01512 3456789\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+4915123456789\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Trunk \u003Ccode>0\u003C\u002Fcode> dropped\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Italy\u003C\u002Ftd>\n\u003Ctd>+39\u003C\u002Ftd>\n\u003Ctd>02 1234 5678\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+390212345678\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>The \u003Ccode>0\u003C\u002Fcode> stays: it is part of the number\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Italy\u003C\u002Ftd>\n\u003Ctd>+39\u003C\u002Ftd>\n\u003Ctd>312 345 6789\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+393123456789\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Mobile, no \u003Ccode>0\u003C\u002Fcode> to begin with\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Spain\u003C\u002Ftd>\n\u003Ctd>+34\u003C\u002Ftd>\n\u003Ctd>612 34 56 78\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+34612345678\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>No trunk prefix in Spain\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Russia\u003C\u002Ftd>\n\u003Ctd>+7\u003C\u002Ftd>\n\u003Ctd>8 (912) 345-67-89\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+79123456789\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Trunk \u003Ccode>8\u003C\u002Fcode> dropped\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Japan\u003C\u002Ftd>\n\u003Ctd>+81\u003C\u002Ftd>\n\u003Ctd>090-1234-5678\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+819012345678\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Trunk \u003Ccode>0\u003C\u002Fcode> dropped\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>China\u003C\u002Ftd>\n\u003Ctd>+86\u003C\u002Ftd>\n\u003Ctd>131 2345 6789\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+8613123456789\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Mobile, no trunk prefix to drop\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Australia\u003C\u002Ftd>\n\u003Ctd>+61\u003C\u002Ftd>\n\u003Ctd>0412 345 678\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+61412345678\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Trunk \u003Ccode>0\u003C\u002Fcode> dropped\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Brazil\u003C\u002Ftd>\n\u003Ctd>+55\u003C\u002Ftd>\n\u003Ctd>(11) 96123-4567\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+5511961234567\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Area code kept, punctuation removed\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Mexico\u003C\u002Ftd>\n\u003Ctd>+52\u003C\u002Ftd>\n\u003Ctd>222 123 4567\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+522221234567\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Ten digits after \u003Ccode>+52\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\n\u003Cp>Each example is either a sample number published in libphonenumber's metadata or a number in NANPA's fictional 555-0100 to 555-0199 range. They show a format; do not expect anyone to answer.\u003C\u002Fp>\n\u003Ch2 id=\"the-trunk-prefix-trap\">The trunk prefix trap\u003C\u002Fh2>\n\u003Cp>The trunk prefix is the digit, or digits, dialed before a national number for calls inside the country: \u003Ccode>0\u003C\u002Fcode> in the UK, France, Germany, Japan and Australia, \u003Ccode>8\u003C\u002Fcode> in Russia, \u003Ccode>1\u003C\u002Fcode> before long-distance calls in North America. It is a dialing instruction, not part of the number, so it disappears after the country code.\u003C\u002Fp>\n\u003Cp>Three cases catch people out:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>The stray zero.\u003C\u002Fstrong> \u003Ccode>+44 07400 123456\u003C\u002Fcode> keeps a trunk \u003Ccode>0\u003C\u002Fcode> after the country code. It is a frequent typo in forms and signatures. The correct form is \u003Ccode>+447400123456\u003C\u002Fcode>. Many people write \u003Ccode>+44 (0)121 234 5678\u003C\u002Fcode> on purpose, to show both forms at once; a parser should drop the \u003Ccode>(0)\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Italy keeps its zero.\u003C\u002Fstrong> Italian landline numbers start with \u003Ccode>0\u003C\u002Fcode>, and that \u003Ccode>0\u003C\u002Fcode> is part of the number. Dropping it produces \u003Ccode>+39 2 1234 5678\u003C\u002Fcode>, which is not a valid number at all.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>The North American 1.\u003C\u002Fstrong> The \u003Ccode>1\u003C\u002Fcode> dialed before a long-distance number in the US is also the country code. In E.164 it appears once: \u003Ccode>+14155550123\u003C\u002Fcode>, never \u003Ccode>+114155550123\u003C\u002Fcode>.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>Hand-written conversion rules, such as &quot;strip the first 0 and add the country code&quot;, break on exactly these cases. Use a parser that knows each country's plan.\u003C\u002Fp>\n\u003Ch2 id=\"exit-codes-are-not-part-of-the-number\">Exit codes are not part of the number\u003C\u002Fh2>\n\u003Cp>To call abroad, people dial an exit code first. Most countries use \u003Ccode>00\u003C\u002Fcode>, the prefix ITU-T recommends. The exceptions are the ones that leak into databases: \u003Ccode>011\u003C\u002Fcode> from the United States and Canada, \u003Ccode>010\u003C\u002Fcode> from Japan, \u003Ccode>0011\u003C\u002Fcode> from Australia.\u003C\u002Fp>\n\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Stored value\u003C\u002Fth>\n\u003Cth>Problem\u003C\u002Fth>\n\u003Cth>E.164\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\n\u003Ctd>\u003Ccode>0044 7400 123456\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Exit code of Europe stored with the number\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+447400123456\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>011 44 7400 123456\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Exit code of North America stored with the number\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+447400123456\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>447400123456\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Plus sign missing: software may read it as a national number\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+447400123456\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>7400 123456\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Country code missing\u003C\u002Ftd>\n\u003Ctd>Cannot be fixed without knowing the country\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\n\u003Cp>A stored number has to work from anywhere. Only the plus sign does.\u003C\u002Fp>\n\u003Ch2 id=\"shared-calling-codes-e164-does-not-name-the-country\">Shared calling codes: E.164 does not name the country\u003C\u002Fh2>\n\u003Cp>A calling code is not always one country. \u003Ccode>+1\u003C\u002Fcode> covers the United States, Canada and a number of Caribbean and Pacific territories. \u003Ccode>+7\u003C\u002Fcode> covers Russia and Kazakhstan. \u003Ccode>+44\u003C\u002Fcode> covers the United Kingdom, Jersey, Guernsey and the Isle of Man. The leading digits after the code decide which one a number belongs to: \u003Ccode>+1 876\u003C\u002Fcode> is Jamaica, \u003Ccode>+44 1534\u003C\u002Fcode> is Jersey.\u003C\u002Fp>\n\u003Cp>So E.164 identifies a line, not a country you can read off at a glance. When the country matters, for display, tax, routing or compliance, store the ISO 3166-1 code next to the number. The \u003Ca href=\"\u002Ftools\u002Fcountry-calling-codes\">country calling codes\u003C\u002Fa> tool lists every shared code and how its members are told apart.\u003C\u002Fp>\n\u003Ch2 id=\"how-to-store-phone-numbers\">How to store phone numbers\u003C\u002Fh2>\n\u003Cul>\n\u003Cli>\u003Cstrong>One text column for the E.164 value.\u003C\u002Fstrong> 16 characters fit the plus sign and 15 digits.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Never a numeric type.\u003C\u002Fstrong> Integers drop the plus sign, and spreadsheets can display long numbers in scientific notation.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>A shape constraint.\u003C\u002Fstrong> Let the database refuse anything that is not E.164.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>A unique index where a number identifies an account.\u003C\u002Fstrong> It only works because every number has one spelling.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>The ISO country code next to it\u003C\u002Fstrong>, for display and for the shared codes above.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Extensions in their own column.\u003C\u002Fstrong> E.164 has no room for them.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Normalize on write, format on read.\u003C\u002Fstrong> Convert at the moment the number is saved, and format it at the moment it is shown.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>In PostgreSQL, for example:\u003C\u002Fp>\n\u003Cpre class=\"shiki shiki-themes github-light github-dark\" style=\"--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e\" tabindex=\"0\">\u003Ccode class=\"language-text\">\u003Cspan class=\"line\">\u003Cspan>CREATE TABLE contacts (\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan>  id            bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan>  phone_e164    varchar(16) CHECK (phone_e164 ~ '^\\+[1-9][0-9]{1,14}$'),\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan>  phone_country char(2),\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan>  phone_ext     varchar(10),\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan>  phone_raw     text\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan>);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan>\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan>CREATE UNIQUE INDEX contacts_phone_e164_key ON contacts (phone_e164);\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>\u003Ccode>phone_raw\u003C\u002Fcode> is optional. Keeping what the person typed helps when you investigate a support ticket, but never compare or deduplicate on it.\u003C\u002Fp>\n\u003Ch2 id=\"convert-to-e164-with-the-api\">Convert to E.164 with the API\u003C\u002Fh2>\n\u003Cp>Send what the person typed and, for numbers without a \u003Ccode>+\u003C\u002Fcode>, the country they chose:\u003C\u002Fp>\n\u003Cpre class=\"shiki shiki-themes github-light github-dark\" style=\"--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e\" tabindex=\"0\">\u003Ccode class=\"language-bash\">\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">curl\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\"> https:\u002F\u002Fapi.qelka.com\u002Fv1\u002Fphone\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\"> \\\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\">  -H\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\"> \"Authorization: Bearer \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">$API_KEY\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\"> \\\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\">  -H\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\"> \"Content-Type: application\u002Fjson\"\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\"> \\\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\">  -d\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\"> '{\"phone\": \"06 12 34 56 78\", \"country\": \"FR\"}'\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>The result carries \u003Ccode>e164: &quot;+33612345678&quot;\u003C\u002Fcode>, \u003Ccode>national: &quot;06 12 34 56 78&quot;\u003C\u002Fcode>, \u003Ccode>valid: true\u003C\u002Fcode> and \u003Ccode>line_type: &quot;mobile&quot;\u003C\u002Fcode>. The basic level, at 1 credit, is all formatting needs.\u003C\u002Fp>\n\u003Cp>In JavaScript:\u003C\u002Fp>\n\u003Cpre class=\"shiki shiki-themes github-light github-dark\" style=\"--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e\" tabindex=\"0\">\u003Ccode class=\"language-javascript\">\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">export\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\"> async\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\"> function\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\"> toE164\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#E36209;--shiki-dark:#FFAB70\">phone\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#E36209;--shiki-dark:#FFAB70\">country\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">  const\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\"> response\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\"> =\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\"> await\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\"> fetch\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\">'https:\u002F\u002Fapi.qelka.com\u002Fv1\u002Fphone'\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">, {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">    method: \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\">'POST'\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">    headers: {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">      Authorization: \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\">`Bearer ${\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">process\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\">.\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">env\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\">.\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\">API_KEY\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\">}`\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\">      'Content-Type'\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">: \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\">'application\u002Fjson'\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">    },\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">    body: \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\">JSON\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">.\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">stringify\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">(country \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">?\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> { phone, country } \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">:\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> { phone }),\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">    signal: AbortSignal.\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">timeout\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\">5000\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">),\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">  })\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">  if\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> (\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">!\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">response.ok) \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">throw\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\"> new\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\"> Error\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\">`Phone check failed with HTTP ${\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">response\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\">.\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">status\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\">}`\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">  const\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\"> result\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\"> =\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\"> await\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> response.\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#6F42C1;--shiki-dark:#B392F0\">json\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">()\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">  if\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> (result.status \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">===\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\"> 'unknown'\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">) \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">return\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> { e164: \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\">null\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">, problem: \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\">'missing_country'\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">  if\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> (\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">!\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">result.valid) \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">return\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> { e164: \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\">null\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">, problem: \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#032F62;--shiki-dark:#9ECBFF\">'invalid'\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#D73A49;--shiki-dark:#F97583\">  return\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> { e164: result.e164, country: result.country.code, problem: \u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#005CC5;--shiki-dark:#79B8FF\">null\u003C\u002Fspan>\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\"> }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"--shiki-light:#24292E;--shiki-dark:#E1E4E8\">}\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>The function returns the ISO country with the number, ready for the \u003Ccode>phone_country\u003C\u002Fcode> column.\u003C\u002Fp>\n\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Input\u003C\u002Fth>\n\u003Cth>\u003Ccode>country\u003C\u002Fcode> sent\u003C\u002Fth>\n\u003Cth>Result\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\n\u003Ctd>\u003Ccode>(415) 555-0123\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>US\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>e164: &quot;+14155550123&quot;\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>07400 123456\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>GB\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>e164: &quot;+447400123456&quot;\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>+49 1512 3456789\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>any, or none\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>e164: &quot;+4915123456789&quot;\u003C\u002Fcode>: the \u003Ccode>+\u003C\u002Fcode> makes \u003Ccode>country\u003C\u002Fcode> unnecessary\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>415 555 0123\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>none\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>status: &quot;unknown&quot;\u003C\u002Fcode>, \u003Ccode>e164: null\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\n\u003Ch3 id=\"choose-the-default-country-well\">Choose the default country well\u003C\u002Fh3>\n\u003Cp>The \u003Ccode>country\u003C\u002Fcode> field only matters for numbers typed without a \u003Ccode>+\u003C\u002Fcode>. In order of reliability: a country picker next to the phone field, then a country you already know from a billing or shipping address, then the country of the request as your CDN reports it. Avoid one fixed default for everyone: a French number typed at home and read as a US number is invalid.\u003C\u002Fp>\n\u003Ch3 id=\"numbers-you-already-have\">Numbers you already have\u003C\u002Fh3>\n\u003Cp>For an existing table, send up to 100 numbers per \u003Ca href=\"\u002Fdocs\u002Fapi-reference\u002Fbatch\">batch\u003C\u002Fa> call, each with the best country you have for its row, and write \u003Ccode>e164\u003C\u002Fcode> back. For a whole file, a bulk job does the same in the background and returns your file with the result columns added. Rows that come back without an \u003Ccode>e164\u003C\u002Fcode> need a human look rather than a guess.\u003C\u002Fp>\n\u003Ch2 id=\"what-to-do-with-the-result\">What to do with the result\u003C\u002Fh2>\n\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Result\u003C\u002Fth>\n\u003Cth>What to store\u003C\u002Fth>\n\u003Cth>What to tell the user\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\n\u003Ctd>\u003Ccode>status: &quot;valid&quot;\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>e164\u003C\u002Fcode>, plus \u003Ccode>country.code\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Nothing, or echo the \u003Ccode>national\u003C\u002Fcode> form back\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>status: &quot;invalid&quot;\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Nothing\u003C\u002Ftd>\n\u003Ctd>Ask them to check the number, and show an example for their country\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>status: &quot;unknown&quot;\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Nothing\u003C\u002Ftd>\n\u003Ctd>Ask for the country, or for the number with its \u003Ccode>+\u003C\u002Fcode> code\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\n\u003Cp>Store the E.164 value only when \u003Ccode>valid\u003C\u002Fcode> is \u003Ccode>true\u003C\u002Fcode>. A value you cannot dial is worse than an empty field, because it looks usable.\u003C\u002Fp>\n\u003Ch2 id=\"display-numbers-back-to-people\">Display numbers back to people\u003C\u002Fh2>\n\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Where the number appears\u003C\u002Fth>\n\u003Cth>Format\u003C\u002Fth>\n\u003Cth>Example\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\n\u003Ctd>A screen read by someone in the same country\u003C\u002Ftd>\n\u003Ctd>National, as \u003Ccode>national\u003C\u002Fcode> returns it\u003C\u002Ftd>\n\u003Ctd>07400 123456\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>A page or invoice read in several countries\u003C\u002Ftd>\n\u003Ctd>International, as E.123 groups it\u003C\u002Ftd>\n\u003Ctd>+44 7400 123456\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>A clickable call link\u003C\u002Ftd>\n\u003Ctd>RFC 3966 \u003Ccode>tel:\u003C\u002Fcode> URI\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>tel:+447400123456\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>A database, a CRM, an SMS provider\u003C\u002Ftd>\n\u003Ctd>E.164\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+447400123456\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\n\u003Cp>To get the international format from a stored E.164 value, use a formatting library such as libphonenumber-js. A \u003Ccode>tel:\u003C\u002Fcode> link built on the E.164 value dials correctly from any phone in any country.\u003C\u002Fp>\n\u003Ch2 id=\"edge-cases\">Edge cases\u003C\u002Fh2>\n\u003Cul>\n\u003Cli>\u003Cstrong>Short codes and emergency numbers\u003C\u002Fstrong> such as 911 or 112 are not E.164 subscriber numbers. Keep them out of this flow.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Global service codes\u003C\u002Fstrong> such as \u003Ccode>+800\u003C\u002Fcode>, the universal international freephone code, are valid E.164 numbers with no country at all.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Extensions\u003C\u002Fstrong> go in their own field. \u003Ccode>+14155550123 x42\u003C\u002Fcode> is not E.164.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Numbers change hands.\u003C\u002Fstrong> A valid E.164 value says the number exists, not that it still belongs to the person who gave it to you. \u003Ca href=\"\u002Fblog\u002Fvoip-number-lookup\">Mobile, landline or VoIP\u003C\u002Fa> explains porting and live carrier lookups.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>To try a few numbers by hand, the free \u003Ca href=\"\u002Ftools\u002Fphone-number-formatter\">phone number formatter\u003C\u002Fa> shows the E.164, international, national and \u003Ccode>tel:\u003C\u002Fcode> forms of any number. The \u003Ca href=\"\u002Fdocs\u002Fguides\u002Fformat-phone-numbers-e164\">E.164 formatting guide\u003C\u002Fa> has the same conversion in Python, and the \u003Ca href=\"\u002Fdocs\u002Fapi-reference\u002Fphone\">phone API reference\u003C\u002Fa> lists every field.\u003C\u002Fp>\n",[11,15,18,21,24,27,30,33,37,40,43,46],{"id":12,"text":13,"depth":14},"what-an-e164-number-is-made-of","What an E.164 number is made of",2,{"id":16,"text":17,"depth":14},"e164-examples-by-country","E.164 examples by country",{"id":19,"text":20,"depth":14},"the-trunk-prefix-trap","The trunk prefix trap",{"id":22,"text":23,"depth":14},"exit-codes-are-not-part-of-the-number","Exit codes are not part of the number",{"id":25,"text":26,"depth":14},"shared-calling-codes-e164-does-not-name-the-country","Shared calling codes: E.164 does not name the country",{"id":28,"text":29,"depth":14},"how-to-store-phone-numbers","How to store phone numbers",{"id":31,"text":32,"depth":14},"convert-to-e164-with-the-api","Convert to E.164 with the API",{"id":34,"text":35,"depth":36},"choose-the-default-country-well","Choose the default country well",3,{"id":38,"text":39,"depth":36},"numbers-you-already-have","Numbers you already have",{"id":41,"text":42,"depth":14},"what-to-do-with-the-result","What to do with the result",{"id":44,"text":45,"depth":14},"display-numbers-back-to-people","Display numbers back to people",{"id":47,"text":48,"depth":14},"edge-cases","Edge cases",[50,53,56,59,62,65,68],{"q":51,"a":52},"What is E.164 format?","E.164 format writes a phone number as a plus sign, the country calling code and the national number, with no spaces or punctuation and 15 digits at most. A London mobile written 07400 123456 at home becomes +447400123456. The name comes from ITU-T Recommendation E.164, the international public telecommunication numbering plan. SMS and voice APIs commonly expect numbers in this form, which is why it is the one to store.",{"q":54,"a":55},"What does a US phone number look like in E.164?","A plus sign, the country code 1, then the ten digits of the number: area code, exchange and line number. (415) 555-0123 becomes +14155550123. The leading 1 that Americans dial before long-distance calls is the country code here, so it appears once, never twice. Canada and the other members of the North American Numbering Plan use the same +1 and the same ten-digit structure.",{"q":57,"a":58},"Do I keep the leading 0 when converting to E.164?","Usually not. In the UK, France, Germany, Japan, Australia and many other countries, the leading 0 is a trunk prefix dialed only inside the country, so it is dropped after the country code: 07400 123456 becomes +447400123456. Italy is the classic exception. Its landline numbers keep their 0, so 02 1234 5678 in Milan becomes +390212345678. A parser that knows each country's plan handles both cases.",{"q":60,"a":61},"How long can an E.164 number be?","At most 15 digits, counting the country calling code and not counting the plus sign. Country codes have one to three digits, so the national part can be up to 14 digits for a one-digit code like +1 and up to 12 for a three-digit code like +353. In practice most numbers are shorter. A text column of 16 characters holds any E.164 number with its plus sign.",{"q":63,"a":64},"Should I store phone numbers in E.164?","Yes, as the canonical value. One number then has exactly one spelling, so unique constraints, deduplication and lookups work, and the country travels with the number. Keep the ISO country code beside it when you display national formats, because +1 alone does not tell the United States from Canada. Store extensions in a separate column and format numbers for humans only when you show them.",{"q":66,"a":67},"Is E.164 the same as the international format?","Not quite. E.164 is the machine form, with no spaces: +442079460123. The international format people read groups the same digits with spaces, as ITU-T E.123 describes: +44 20 7946 0123. Both start with a plus sign and drop the trunk prefix. Store the first and print the second on pages read by people in several countries. For call links, use tel:+442079460123 as RFC 3966 defines.",{"q":69,"a":70},"How do I check that a string is in E.164 format?","A shape check is simple: a plus sign, a first digit from 1 to 9, then 1 to 14 more digits, with nothing else. That catches spaces, missing plus signs and exit codes. It does not tell you the number is valid in its country: +11234567890 has the right shape but no North American area code starts with 1. Run a numbering plan check, such as the \u003Ca href=\"\u002Ftools\u002Fphone-validator\">phone validator\u003C\u002Fa>, for that.","2026-11-23",1934,{},1795474028851]