Guide

Country Phone Codes (ITU-T E.164) — Complete Guide for Developers

March 22, 2026 10 min read CountryDataAPI Team

Reference guide to international country phone codes (ITU-T E.164). Learn how dialing codes work, common pitfalls, and how to fetch them programmatically via REST API.

If you're building a contact form with phone validation, an SMS service, a CRM, or anything that handles international phone numbers, you need to understand ITU-T E.164 — the international telephone numbering plan that defines country calling codes. This guide explains what country phone codes are, how they're structured, common gotchas, and how to fetch them from a single API call.

What is ITU-T E.164?

ITU-T E.164 is the international standard published by the International Telecommunication Union (ITU) that defines a maximum-15-digit format for international telephone numbers. The standard was first published in 1984 and is regularly updated to add or remove country codes as the telephony landscape evolves.

An E.164 phone number always starts with a country calling code (also called a country dialing code or simply country code), followed by the national subscriber number. For example:

  • +1 415 555 1234 — US number with country code +1
  • +44 20 7946 0958 — UK number with country code +44
  • +49 30 12345678 — German number with country code +49
  • +81 3 1234 5678 — Japanese number with country code +81

The "+" symbol is the international prefix, replacing the local trunk prefix that varies by country (in the US it's "011", in most of Europe it's "00").

How Country Phone Codes Are Assigned

Country codes are assigned by the ITU in zones, which loosely correspond to geographic regions:

ZoneRegionExamples
1North America (NANP)USA, Canada, Caribbean
2AfricaEgypt (+20), South Africa (+27), Nigeria (+234)
3 / 4EuropeUK (+44), Germany (+49), Spain (+34), Italy (+39)
5South & Central AmericaCuba (+53), Argentina (+54), Brazil (+55), Mexico (+52)
6Southeast Asia & OceaniaMalaysia (+60), Australia (+61), Indonesia (+62)
7Russia & KazakhstanRussia (+7), Kazakhstan (+7)
8East Asia & special servicesJapan (+81), South Korea (+82), China (+86)
9West & South Asia, Middle EastTurkey (+90), India (+91), Saudi Arabia (+966)

Country Codes Are Not Always Country-Specific

The biggest confusion with E.164 is that several countries can share the same code. The North American Numbering Plan (NANP) uses +1 for the United States, Canada, and 25 Caribbean territories including Bermuda, the Cayman Islands, Jamaica, Puerto Rico, the Dominican Republic and the Bahamas. Within this single code, the countries are distinguished by their three-digit area code (NPA).

Russia and Kazakhstan share +7 as the result of their shared Soviet-era telephony infrastructure.

Other quirks:

  • Vatican City uses Italy's +39 with a local prefix of 06 698
  • Monaco has its own code (+377) but historically used France's +33
  • Christmas Island and the Cocos Islands use Australia's +61
  • The Falkland Islands have their own code +500

Length of Country Codes

Country calling codes vary in length from 1 to 3 digits:

  • 1 digit: Only +1 (NANP) and +7 (Russia/Kazakhstan)
  • 2 digits: Most major countries — +44 UK, +49 Germany, +33 France, +86 China, +91 India
  • 3 digits: Many smaller countries — +234 Nigeria, +966 Saudi Arabia, +507 Panama, +998 Uzbekistan

This variable length is why you can't just take the first two characters of a phone number to determine the country — you need a proper E.164 parser.

Fetching Country Phone Codes via REST API

The Country Data API includes phone codes in every country object returned by the /v1/countries endpoint:

GET https://api.countrydataapi.com/v1/countries
Authorization: Bearer YOUR_API_KEY

Each country object includes a phone_code field:

{
  "name": "Germany",
  "iso2": "DE",
  "iso3": "DEU",
  "phone_code": "49"
}

You can also filter countries by phone code if needed via the all countries endpoint and a client-side filter, since the field is returned alongside every country.

Building an International Phone Input — JavaScript Example

Here's a complete example that fetches country codes and renders an internationalized phone input:

async function buildPhoneInput() {
  const res = await fetch('https://api.countrydataapi.com/v1/countries', {
    headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
  });
  const countries = await res.json();

  // Sort by name and build option list
  countries.sort((a, b) => a.name.localeCompare(b.name));

  const select = document.getElementById('phone-country');
  for (const country of countries) {
    const opt = document.createElement('option');
    opt.value = country.iso2;
    opt.dataset.phoneCode = country.phone_code;
    opt.textContent = `${country.name} (+${country.phone_code})`;
    select.appendChild(opt);
  }

  // When the user changes country, update the input prefix
  const phoneInput = document.getElementById('phone-number');
  select.addEventListener('change', (e) => {
    const code = e.target.options[e.target.selectedIndex].dataset.phoneCode;
    phoneInput.placeholder = `+${code} ...`;
  });
}

Validating International Phone Numbers

For full E.164 validation (including format, length and number-type detection), don't try to write your own regex. Use a battle-tested library:

  • JavaScript / TypeScript: libphonenumber-js
  • Python: phonenumbers
  • PHP: giggsey/libphonenumber-for-php
  • Java / Android: Google's official libphonenumber

These libraries handle the messy edge cases: variable-length area codes, mobile vs landline detection, formatting for display, and parsing user input that may or may not include the international prefix.

Common Pitfalls

Don't store phone numbers without the country code. Always store in E.164 format (e.g., +14155551234) so the data is unambiguous regardless of where it's read.

Don't assume +1 means USA. A phone number starting with +1 876 is Jamaica, +1 246 is Barbados, +1 809 is the Dominican Republic. Use a library that recognizes the area code.

Don't strip the leading "+". The plus sign is part of the E.164 format. If you must use a different prefix (like 00) for legacy reasons, do that conversion at the display layer, not in storage.

Watch for country phone code changes. When South Sudan separated from Sudan in 2011, it received its own code (+211). When countries split or merge, codes can change. An always-updated API is safer than a hard-coded list.

Get Started

To fetch country phone codes for your application, create a free account at CountryDataAPI. The phone code is returned in every country object alongside ISO codes, currency, languages and more. Plans start at $9.99/month with 10,000 monthly requests.

For full reference, see the countries endpoint documentation.

Related Guides