Developer
Encoders, converters & dev utilities
Regex to Match a Phone Number (E.164)
To match a phone number in the international E.164 format, use ^\+[1-9]\d{7,14}$ — a leading plus sign, a non-zero country-code digit, then between 7 and 14 more digits, for a maximum of 15 digits total. E.164 is the canonical, unambiguous way to store phone numbers: it has no spaces, dashes, parentheses or leading zeros, which is exactly why it is regex-friendly. Local and national formats vary enormously from country to country, so the realistic strategy is to normalise a number to E.164 first (a library such as libphonenumber does this) and then apply this simple shape check. This JavaScript pattern is verified in CI against real examples and counter-examples. Copy it, try your own numbers in the live in-browser tester, and remember that matching the shape does not prove the number is assigned or reachable. Free, no login.
Pattern: ^\+[1-9]\d{7,14}$ (E.164 international format)
- Matches: +14155552671 and +919876543210
- Rejects: 4155552671 (no +), +0123 (leading zero / too short) and "+1 415 555 2671" (spaces)
- E.164 allows at most 15 digits total after the +
- Normalise to E.164 first (e.g. libphonenumber); local formats vary too much to regex directly
Frequently asked questions
What is the regex for an international phone number?
For E.164 — the international standard format — use ^\+[1-9]\d{7,14}$. It requires a leading +, a first digit from 1–9 (country codes never start with 0), and 7 to 14 further digits, capping the total at 15 digits. So +14155552671 and +919876543210 match, while a number with no +, a leading zero, or spaces does not. E.164 is deliberately punctuation-free, which is what makes it easy to validate.
Why is it so hard to write a regex for any phone number?
Because every country has its own length rules, area-code structure and conventional punctuation (spaces, dashes, parentheses, leading trunk zeros). A single regex that accepts every valid local format worldwide would be unreadable and still wrong. The practical approach is to normalise input to E.164 using a phone-number library, then apply a simple shape check like ^\+[1-9]\d{7,14}$. Even then, matching the shape does not confirm the number is actually assigned or in service.