Phone number (E.164) regex
An international number in E.164 form: a +, a country code that does not start with 0, and at most fifteen digits in all, with no spaces. Copy the pattern, with 4 inputs it accepts and 5 it rejects, each checked against it at build time.
Part of developer tools.
^\+[1-9]\d{1,14}$/^\+[1-9]\d{1,14}$/Flags: none
Open in the testerWhat the phone number (e.164) regex accepts and rejects
Each result below is the output of the pattern itself, run on the input when this page was built — not a claim copied next to it. A wrong verdict stops the build.
| Input | Result | Why |
|---|---|---|
| +33612345678 | Passes | a French mobile |
| +14155552671 | Passes | a US number |
| +442071838750 | Passes | a London landline |
| 0612345678 | Fails | national format, no country code |
| +33 6 12 34 56 78 | Fails | spaces |
| +1 (415) 555-2671 | Fails | punctuation |
| +0123456 | Fails | a country code cannot start with 0 |
| +1234567890123456 | Fails | sixteen digits |
What it wrongly lets through
These inputs match although they are not valid — checked the same way, so this list is as true as the one above.
| Input | Result | Why |
|---|---|---|
| +12 | Passes | far too short to be a real number |
Limits
- E.164 is the storage format, not what people type: normalise spaces, dots, dashes and a leading 00 to a + before matching, or the pattern will refuse most real input.
- The length check is global. Whether a number is valid for its country — right length, allocated prefix — needs the numbering plan of that country, which is what a library such as libphonenumber carries.
Try it on your own input
Open this pattern in the regex tester with every example above on its own line. The link adds the g and m flags so that ^ and $ hold per line and every line is tested: the highlighted lines are the ones marked as passing here. Paste your own data in place of the examples — it is matched in your browser and never uploaded.
Other common regexes
- Email address
- URL
- UUID
- IPv4 address
- Hex color
- ISO 8601 date
- 24-hour time
- Semantic version
- URL slug
- US ZIP code
- MAC address
Or open the regex tester empty and bring your own pattern.