# What is E.164?

E.164 is the international telephone numbering plan that ensures each device on the Public Switched Telephone Network (PSTN) has a globally unique number.

This numbering plan allows phone calls and text messages to be correctly routed to individual phones in different countries. E.164 numbers are formatted as `+` `country code` `subscriber number including area code` and can have a maximum of fifteen digits.

## Examples of E.164 numbers

| **E.164 Format** | **Country Code** | **Country** | **Subscriber Number** |
| ---------------- | ---------------- | ----------- | --------------------- |
| +14155552671     | 1                | US          | 4155552671            |
| +442071838750    | 44               | GB          | 2071838750            |
| +551155256325    | 55               | BR          | 1155256325            |

### Process international phone number input fields with a country code

| ![Phone number input with country code converted to E.164 format.](https://docs-resources.prod.twilio.com/a55fadcb58713853565a8a9cb39ebb6d08de4e10b072cc91ad37929f2a3497ff.png) | ![phone number input translated to e.164 format.](https://docs-resources.prod.twilio.com/9b79f95a2a78ce94c781b0b69d96e32ed2c7c160daffcd456c758acb6439d16e.png) |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |

For more information, see [the Twilio blog post on building an international phone number input in HTML and JavaScript](https://www.twilio.com/blog/international-phone-number-input-html-javascript), including how to transform the phone number input into E.164 format.

## How to validate a phone number

You can **use the Twilio Lookup API** to [perform phone number validation and formatting without the need for RegEx](https://www.twilio.com/blog/validate-phone-number-input). You can also find [international telephone input and validation in the Twilio Code Exchange](https://www.twilio.com/code-exchange/international-telephone-input).

![Phone number entry with error message 'Invalid phone number.'.](https://docs-resources.prod.twilio.com/73b581a97ec326ad19d860a3ca1a613a2d9f19211ef69de3634df261e17caace.png)

Reasons to programmatically verify that a string is in a valid E.164 phone number include:

* Preventing fraud when capturing a user's phone number in a form
* Ensuring deliverability when sending a Twilio SMS or Voice call
* Validating previously collected phone numbers in a database

### Regex matching for E.164

According to the [official ITU E.164 recommendation](https://www.itu.int/rec/T-REC-E.164/en), the format must be a number up to fifteen digits in length starting with a '+'. You can also exclude 0 as the first character, since there are no [country codes](https://en.wikipedia.org/wiki/List_of_country_calling_codes) that start with 0. Below is a sample regular expression:

`^\+[1-9]\d{1,14}$`

However, this will also match numbers that are not valid phone numbers. **We recommend using the [Twilio Lookup API](/docs/lookup/v1-api) for comprehensive phone number validation.**
