[{"data":1,"prerenderedAt":87},["ShallowReactive",2],{"content:en:blog\u002Fphone-number-formats-by-country":3},{"path":4,"locale":5,"section":6,"title":7,"description":8,"html":9,"headings":10,"faq":64,"updated":83,"order":84,"words":85,"meta":86},"blog\u002Fphone-number-formats-by-country","en","blog","Phone number formats by country: trunk prefixes, lengths and writing styles","How phone numbers are written in the US, UK, France, Germany, Brazil, Japan and more: trunk prefixes, dialing prefixes, lengths and the traps for forms.","\u003Cp>There is no common way to write a phone number. ITU-T Recommendation E.164 fixes only the frame: a country calling code of one to three digits, then a national number, with 15 digits at most in total. Everything inside that frame is a national decision: how many digits, how they are grouped, which leading digit marks a mobile line and whether you dial an extra digit before the number at home. A form that works in one country because it assumes its plan fails in every other, and that is where most phone validation bugs start.\u003C\u002Fp>\n\u003Ch2 id=\"the-frame-everyone-shares\">\u003Ca class=\"heading-link\" href=\"#the-frame-everyone-shares\">\u003Cspan>The frame everyone shares\u003C\u002Fspan>\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cp>An international number has two parts.\u003C\u002Fp>\n\u003Cdiv class=\"table-wrap\">\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Part\u003C\u002Fth>\n\u003Cth>What it is\u003C\u002Fth>\n\u003Cth>Example\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\n\u003Ctd>Country calling code\u003C\u002Ftd>\n\u003Ctd>One to three digits that name a country or a shared plan\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>44\u003C\u002Fcode> for the United Kingdom, \u003Ccode>1\u003C\u002Fcode> for the North American plan\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>National (significant) number\u003C\u002Ftd>\n\u003Ctd>What identifies a line inside the country, without any dialing prefix\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>7400123456\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\u003C\u002Fdiv>\n\u003Cp>Written together with a plus sign, they form the E.164 number: \u003Ccode>+447400123456\u003C\u002Fcode>. The plus sign stands for the international dialing prefix of the country the caller is in. A person in the US dials \u003Ccode>011\u003C\u002Fcode> to start an international call, and a person in the UK dials \u003Ccode>00\u003C\u002Fcode>, so a printed \u003Ccode>+\u003C\u002Fcode> works from both. \u003Ca href=\"\u002Fblog\u002Fe164-format\">E.164 explained\u003C\u002Fa> covers the storage side.\u003C\u002Fp>\n\u003Ch2 id=\"three-kinds-of-prefix-that-confuse-forms\">\u003Ca class=\"heading-link\" href=\"#three-kinds-of-prefix-that-confuse-forms\">\u003Cspan>Three kinds of prefix that confuse forms\u003C\u002Fspan>\u003C\u002Fa>\u003C\u002Fh2>\n\u003Col>\n\u003Cli>\u003Cstrong>The international prefix\u003C\u002Fstrong> is what you dial to leave your country. The \u003Ccode>libphonenumber-js\u003C\u002Fcode> metadata lists \u003Ccode>011\u003C\u002Fcode> for the United States, \u003Ccode>00\u003C\u002Fcode> for the United Kingdom, France, Germany, Spain and India, \u003Ccode>010\u003C\u002Fcode> for Japan and \u003Ccode>0011\u003C\u002Fcode> as the default for Australia.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>The trunk prefix\u003C\u002Fstrong>, or national prefix, is what you dial before a national number to call inside the country. It is \u003Ccode>0\u003C\u002Fcode> in the UK, France, Germany and Japan, and \u003Ccode>1\u003C\u002Fcode> in the US and Canada for long distance. It is not part of the number and does not appear in E.164.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>The country calling code\u003C\u002Fstrong> is the part that stays.\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cp>Mixing them up is the commonest mistake. A French user types \u003Ccode>06 12 34 56 78\u003C\u002Fcode>. The \u003Ccode>0\u003C\u002Fcode> is the trunk prefix. In E.164 the number is \u003Ccode>+33612345678\u003C\u002Fcode>, with the \u003Ccode>0\u003C\u002Fcode> gone.\u003C\u002Fp>\n\u003Cp>The UK and a few other countries print both forms on purpose: \u003Ccode>+44 (0) 7400 123456\u003C\u002Fcode> shows that the \u003Ccode>0\u003C\u002Fcode> is used at home and dropped from abroad. A parser removes the bracketed \u003Ccode>0\u003C\u002Fcode>: we ran \u003Ccode>parsePhoneNumber('+44 (0) 7400 123456')\u003C\u002Fcode> in \u003Ccode>libphonenumber-js\u003C\u002Fcode> 1.13.17 and it returned \u003Ccode>+447400123456\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Ch2 id=\"mobile-numbers-in-sixteen-countries\">\u003Ca class=\"heading-link\" href=\"#mobile-numbers-in-sixteen-countries\">\u003Cspan>Mobile numbers in sixteen countries\u003C\u002Fspan>\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cp>The table lists the example mobile number the \u003Ccode>libphonenumber-js\u003C\u002Fcode> metadata gives for each country, in the national and international style it prints. The examples are metadata samples, not real subscribers. The last column is the length of the national number in the example.\u003C\u002Fp>\n\u003Cdiv class=\"table-wrap\">\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Country\u003C\u002Fth>\n\u003Cth>Example, national style\u003C\u002Fth>\n\u003Cth>International style\u003C\u002Fth>\n\u003Cth>Digits in the national number\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\n\u003Ctd>United States\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>(201) 555-0123\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+1 201 555 0123\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>10\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>United Kingdom\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>07400 123456\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+44 7400 123456\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>10\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>France\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>06 12 34 56 78\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+33 6 12 34 56 78\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>9\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Germany\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>01512 3456789\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+49 1512 3456789\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>11\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Spain\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>612 34 56 78\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+34 612 34 56 78\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>9\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Italy\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>312 345 6789\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+39 312 345 6789\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>10\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Netherlands\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>06 12345678\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+31 6 12345678\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>9\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Switzerland\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>078 123 45 67\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+41 78 123 45 67\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>9\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Poland\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>512 345 678\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+48 512 345 678\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>9\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Brazil\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>(11) 96123-4567\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+55 11 96123 4567\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>11\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>India\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>081234 56789\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+91 81234 56789\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>10\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Japan\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>090-1234-5678\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+81 90 1234 5678\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>10\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Australia\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>0412 345 678\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+61 412 345 678\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>9\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>New Zealand\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>021 123 4567\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+64 21 123 4567\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>9\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Argentina\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>011 15-2345-6789\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+54 9 11 2345 6789\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>11\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Mexico\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>222 123 4567\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>\u003Ccode>+52 222 123 4567\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>10\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\u003C\u002Fdiv>\n\u003Cp>In the United States and Mexico, the example type comes back \u003Ccode>FIXED_LINE_OR_MOBILE\u003C\u002Fcode>, since those plans do not separate the two. The rest are mobile.\u003C\u002Fp>\n\u003Cp>Look at what varies: the grouping, the separators (spaces, dashes, brackets), whether a trunk \u003Ccode>0\u003C\u002Fcode> leads the national form, and the length from 9 to 11 digits for one line type. A single regular expression cannot describe that.\u003C\u002Fp>\n\u003Ch2 id=\"lengths-what-the-metadata-says\">\u003Ca class=\"heading-link\" href=\"#lengths-what-the-metadata-says\">\u003Cspan>Lengths: what the metadata says\u003C\u002Fspan>\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cp>Plans set which lengths are allowed. These are the national number lengths the \u003Ccode>libphonenumber-js\u003C\u002Fcode> metadata lists as possible for each country, across all line types.\u003C\u002Fp>\n\u003Cdiv class=\"table-wrap\">\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Country\u003C\u002Fth>\n\u003Cth>Possible national lengths\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\n\u003Ctd>United States\u003C\u002Ftd>\n\u003Ctd>10\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>France\u003C\u002Ftd>\n\u003Ctd>9\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Spain\u003C\u002Ftd>\n\u003Ctd>9\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Mexico\u003C\u002Ftd>\n\u003Ctd>10\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Switzerland\u003C\u002Ftd>\n\u003Ctd>9 and 12\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Argentina\u003C\u002Ftd>\n\u003Ctd>10 and 11\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>United Kingdom\u003C\u002Ftd>\n\u003Ctd>7, 9 and 10\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Germany\u003C\u002Ftd>\n\u003Ctd>4 to 15\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>Japan\u003C\u002Ftd>\n\u003Ctd>8 to 17\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\u003C\u002Fdiv>\n\u003Cp>Germany and Japan show why a fixed length rule breaks: the length varies with the area and the line type. A length check in your own code needs per-country data, and that is what libphonenumber compiles. Length is also only the first test: \u003Ccode>+44 7400 12345\u003C\u002Fcode> has a legal UK length of nine digits and is still not a valid UK mobile number, because the plan says numbers starting with 7 have ten.\u003C\u002Fp>\n\u003Ch2 id=\"country-by-country-traps\">\u003Ca class=\"heading-link\" href=\"#country-by-country-traps\">\u003Cspan>Country by country traps\u003C\u002Fspan>\u003C\u002Fa>\u003C\u002Fh2>\n\u003Ch3 id=\"united-states-and-canada\">\u003Ca class=\"heading-link\" href=\"#united-states-and-canada\">\u003Cspan>United States and Canada\u003C\u002Fspan>\u003C\u002Fa>\u003C\u002Fh3>\n\u003Cp>Both sit in the North American Numbering Plan, behind \u003Ccode>+1\u003C\u002Fcode>, with the same ten-digit structure: a three-digit area code, a three-digit exchange and four digits for the line. The area code and the exchange start with 2 to 9. So \u003Ccode>+1\u003C\u002Fcode> alone does not name a country, and the area code decides whether a number is American, Canadian or Caribbean. People may type a leading \u003Ccode>1\u003C\u002Fcode> before a US number, which is the trunk prefix.\u003C\u002Fp>\n\u003Ch3 id=\"united-kingdom\">\u003Ca class=\"heading-link\" href=\"#united-kingdom\">\u003Cspan>United Kingdom\u003C\u002Fspan>\u003C\u002Fa>\u003C\u002Fh3>\n\u003Cp>The trunk \u003Ccode>0\u003C\u002Fcode> and the optional \u003Ccode>(0)\u003C\u002Fcode>. UK mobile numbers start with \u003Ccode>07\u003C\u002Fcode> nationally, so \u003Ccode>+44 7...\u003C\u002Fcode>. In the metadata, the fictional drama range 07700 900000 to 07700 900999 is rejected as invalid, which is a good test case.\u003C\u002Fp>\n\u003Ch3 id=\"france-and-other-countries-with-a-trunk-0\">\u003Ca class=\"heading-link\" href=\"#france-and-other-countries-with-a-trunk-0\">\u003Cspan>France and other countries with a trunk 0\u003C\u002Fspan>\u003C\u002Fa>\u003C\u002Fh3>\n\u003Cp>\u003Ccode>06\u003C\u002Fcode> and \u003Ccode>07\u003C\u002Fcode> open mobile numbers nationally, and the \u003Ccode>0\u003C\u002Fcode> goes in E.164. Digits are grouped in pairs.\u003C\u002Fp>\n\u003Ch3 id=\"italy\">\u003Ca class=\"heading-link\" href=\"#italy\">\u003Cspan>Italy\u003C\u002Fspan>\u003C\u002Fa>\u003C\u002Fh3>\n\u003Cp>Italy keeps the leading zero of a landline number inside the number. We parsed \u003Ccode>+39 06 1234 5678\u003C\u002Fcode> and the national number was \u003Ccode>0612345678\u003C\u002Fcode>, so the \u003Ccode>0\u003C\u002Fcode> stays in E.164 for Italian landlines. A tool that strips every leading zero corrupts those numbers. Mobile numbers begin with 3.\u003C\u002Fp>\n\u003Ch3 id=\"argentina\">\u003Ca class=\"heading-link\" href=\"#argentina\">\u003Cspan>Argentina\u003C\u002Fspan>\u003C\u002Fa>\u003C\u002Fh3>\n\u003Cp>A mobile number carries an extra \u003Ccode>9\u003C\u002Fcode> after the country code when dialed from abroad: \u003Ccode>+54 9 11 2345 6789\u003C\u002Fcode>. Domestically, a mobile may be written with a \u003Ccode>15\u003C\u002Fcode> after the area code. We parsed \u003Ccode>011 15 1234-5678\u003C\u002Fcode> with country \u003Ccode>AR\u003C\u002Fcode> and got \u003Ccode>+5491112345678\u003C\u002Fcode>, with the \u003Ccode>15\u003C\u002Fcode> and the trunk digit removed and the \u003Ccode>9\u003C\u002Fcode> added.\u003C\u002Fp>\n\u003Ch3 id=\"mexico\">\u003Ca class=\"heading-link\" href=\"#mexico\">\u003Cspan>Mexico\u003C\u002Fspan>\u003C\u002Fa>\u003C\u002Fh3>\n\u003Cp>In the metadata we used, \u003Ccode>+52 55 1234 5678\u003C\u002Fcode> is valid and \u003Ccode>+52 1 55 1234 5678\u003C\u002Fcode>, the old form with a \u003Ccode>1\u003C\u002Fcode> after the country code, is not. If your records hold old Mexican numbers in the longer form, expect them to fail against current data and normalize them.\u003C\u002Fp>\n\u003Ch3 id=\"brazil\">\u003Ca class=\"heading-link\" href=\"#brazil\">\u003Cspan>Brazil\u003C\u002Fspan>\u003C\u002Fa>\u003C\u002Fh3>\n\u003Cp>Mobile numbers have 11 digits: a two-digit area code, then nine digits starting with 9. In the metadata we used, \u003Ccode>+55 11 1234 5678\u003C\u002Fcode>, with eight digits after the area code, is not valid, and \u003Ccode>+55 11 91234 5678\u003C\u002Fcode> is a valid mobile number. The international prefix is complicated by carrier selection codes. The metadata lists a pattern for it instead of one value.\u003C\u002Fp>\n\u003Ch3 id=\"germany\">\u003Ca class=\"heading-link\" href=\"#germany\">\u003Cspan>Germany\u003C\u002Fspan>\u003C\u002Fa>\u003C\u002Fh3>\n\u003Cp>Lengths vary from 4 to 15 digits in the metadata, so never apply a fixed length. German area codes also vary in length.\u003C\u002Fp>\n\u003Ch3 id=\"japan\">\u003Ca class=\"heading-link\" href=\"#japan\">\u003Cspan>Japan\u003C\u002Fspan>\u003C\u002Fa>\u003C\u002Fh3>\n\u003Cp>The trunk \u003Ccode>0\u003C\u002Fcode> is written in national numbers, such as \u003Ccode>090-1234-5678\u003C\u002Fcode>. The international prefix is \u003Ccode>010\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Ch2 id=\"what-a-form-should-do\">\u003Ca class=\"heading-link\" href=\"#what-a-form-should-do\">\u003Cspan>What a form should do\u003C\u002Fspan>\u003C\u002Fa>\u003C\u002Fh2>\n\u003Col>\n\u003Cli>\u003Cstrong>Use one input and a country selector.\u003C\u002Fstrong> Split fields fit one plan and break for the rest.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Default the country from the visitor\u003C\u002Fstrong>, such as locale or IP country, and let them change it. A fixed \u003Ccode>US\u003C\u002Fcode> default fails every non-US number typed at home. \u003Ca href=\"\u002Fblog\u002Fip-geolocation-accuracy\">IP geolocation accuracy\u003C\u002Fa> explains how far to trust the location.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Accept any common format.\u003C\u002Fstrong> Strip spaces, dashes, dots and brackets, and set an extension apart.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Parse with the selected country\u003C\u002Fstrong> and show the national format back so the person can check it.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Store E.164\u003C\u002Fstrong> in a text column, with the country.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Show an example number for the selected country\u003C\u002Fstrong> when validation fails.\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cp>The \u003Ca href=\"\u002Ftools\u002Fphone-number-formatter\">phone number formatter\u003C\u002Fa> shows any number in each style, and the \u003Ca href=\"\u002Ftools\u002Fcountry-calling-codes\">country calling codes\u003C\u002Fa> tool lists the codes. The \u003Ca href=\"\u002Fcountry-codes\">country codes\u003C\u002Fa> pages go through each plan, and \u003Ca href=\"\u002Fhelp\u002Fformat-phone-numbers-e164-excel\">format phone numbers to E.164 in Excel\u003C\u002Fa> handles an existing sheet.\u003C\u002Fp>\n\u003Ch2 id=\"check-a-number-with-the-api\">\u003Ca class=\"heading-link\" href=\"#check-a-number-with-the-api\">\u003Cspan>Check a number with the API\u003C\u002Fspan>\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cp>Send what the person typed and the country they picked:\u003C\u002Fp>\n\u003Cdiv class=\"code-block\" data-code-block>\u003Cdiv class=\"code-head\">\u003Cspan class=\"code-label\">bash\u003C\u002Fspan>\u003C\u002Fdiv>\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\u003C\u002Fdiv>\n\u003Cp>The response has \u003Ccode>status: &quot;valid&quot;\u003C\u002Fcode>, \u003Ccode>e164: &quot;+33612345678&quot;\u003C\u002Fcode>, \u003Ccode>national: &quot;06 12 34 56 78&quot;\u003C\u002Fcode> and \u003Ccode>line_type: &quot;mobile&quot;\u003C\u002Fcode>. Without \u003Ccode>country\u003C\u002Fcode>, the same digits return \u003Ccode>status: &quot;unknown&quot;\u003C\u002Fcode>, because without a \u003Ccode>+\u003C\u002Fcode> there is no way to know which plan applies. A number written with the \u003Ccode>00\u003C\u002Fcode> international prefix is read like one that starts with \u003Ccode>+\u003C\u002Fcode>. A basic check costs 1 credit. See the \u003Ca href=\"\u002Fdocs\u002Fapi-reference\u002Fphone\">phone API reference\u003C\u002Fa>, and the \u003Ca href=\"\u002Fphone-validation-api\">phone validation API\u003C\u002Fa> page for volumes.\u003C\u002Fp>\n\u003Ch2 id=\"where-to-go-next\">\u003Ca class=\"heading-link\" href=\"#where-to-go-next\">\u003Cspan>Where to go next\u003C\u002Fspan>\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cul>\n\u003Cli>\u003Ca href=\"\u002Fblog\u002Fphone-number-validation\">Phone number validation\u003C\u002Fa> for the layers behind a check.\u003C\u002Fli>\n\u003Cli>\u003Ca href=\"\u002Fblog\u002Flibphonenumber-guide\">libphonenumber: what Google's library knows\u003C\u002Fa> for the data behind these tables.\u003C\u002Fli>\n\u003Cli>\u003Ca href=\"\u002Fblog\u002Fus-phone-prefixes-who-holds-them\">US phone prefixes: who holds them\u003C\u002Fa> for the North American plan in numbers.\u003C\u002Fli>\n\u003Cli>\u003Ca href=\"\u002Farea-codes\">Area codes\u003C\u002Fa> for the US and Canada.\u003C\u002Fli>\n\u003C\u002Ful>\n",[11,15,18,21,24,27,31,34,37,40,43,46,49,52,55,58,61],{"id":12,"text":13,"depth":14},"the-frame-everyone-shares","The frame everyone shares",2,{"id":16,"text":17,"depth":14},"three-kinds-of-prefix-that-confuse-forms","Three kinds of prefix that confuse forms",{"id":19,"text":20,"depth":14},"mobile-numbers-in-sixteen-countries","Mobile numbers in sixteen countries",{"id":22,"text":23,"depth":14},"lengths-what-the-metadata-says","Lengths: what the metadata says",{"id":25,"text":26,"depth":14},"country-by-country-traps","Country by country traps",{"id":28,"text":29,"depth":30},"united-states-and-canada","United States and Canada",3,{"id":32,"text":33,"depth":30},"united-kingdom","United Kingdom",{"id":35,"text":36,"depth":30},"france-and-other-countries-with-a-trunk-0","France and other countries with a trunk 0",{"id":38,"text":39,"depth":30},"italy","Italy",{"id":41,"text":42,"depth":30},"argentina","Argentina",{"id":44,"text":45,"depth":30},"mexico","Mexico",{"id":47,"text":48,"depth":30},"brazil","Brazil",{"id":50,"text":51,"depth":30},"germany","Germany",{"id":53,"text":54,"depth":30},"japan","Japan",{"id":56,"text":57,"depth":14},"what-a-form-should-do","What a form should do",{"id":59,"text":60,"depth":14},"check-a-number-with-the-api","Check a number with the API",{"id":62,"text":63,"depth":14},"where-to-go-next","Where to go next",[65,68,71,74,77,80],{"q":66,"a":67},"Why do phone numbers look so different between countries?","Each country runs its own numbering plan under ITU-T E.164. The plan sets the length, the grouping, whether a national dialing prefix exists and which digits mark mobile numbers. Only the frame is shared: a country calling code followed by a national number, 15 digits at most in total. The way people write a number is a convention on top of that.",{"q":69,"a":70},"What is a trunk prefix and why does it disappear in international format?","It is a digit dialed before a national number when calling inside the country, such as the 0 in \u003Ccode>07400 123456\u003C\u002Fcode> in the UK or the 1 before a US long-distance number. It belongs to national dialing, not to the number, so it is dropped in E.164: \u003Ccode>+447400123456\u003C\u002Fcode>. Writing \u003Ccode>+44 (0) 7400 123456\u003C\u002Fcode> shows both forms. A parser removes the extra 0.",{"q":72,"a":73},"How many digits is a phone number?","It depends on the country. E.164 caps the full international number at 15 digits including the calling code. Inside that limit, a US or Canadian number has 10 digits after +1, a French one 9 after +33, and German numbers range widely with the area and the type of line. A correct length is necessary for validity but never enough on its own.",{"q":75,"a":76},"Should I split a phone number into several form fields?","No. One field with a country selector copes with every plan, because the grouping and the length differ per country. Separate fields for area code and local number only fit one country's plan and break for the rest. Take one input, parse it with the selected country, show the national format back and store the E.164 form.",{"q":78,"a":79},"How do I write a phone number so it works everywhere?","Use the international format: a plus sign, the country calling code and the national number without the trunk prefix, such as \u003Ccode>+44 7400 123456\u003C\u002Fcode>. The plus sign stands for the international dialing prefix of the caller's country, so the number dials correctly from anywhere. Spaces are only for readability, and E.164 itself has none.",{"q":81,"a":82},"Why does a French or British number fail in my US-only form?","Because the form reads every number as a US number. The same digits mean different things in different plans: \u003Ccode>06 12 34 56 78\u003C\u002Fcode> is a valid French mobile and has no meaning as a US number. Default to the visitor's country, let them change it, and accept the \u003Ccode>+\u003C\u002Fcode> form for any country.","2026-11-24",24,1681,{},1795622073749]