Regex to Match International Phone Numbers

Validate international phone numbers with country codes using this regex pattern. Matches formats like +44 20 7946 0958. Free online regex tool.

Regular Expression

/^\+?\d{1,3}[\s.-]?\(?\d{1,4}\)?[\s.-]?\d{1,4}[\s.-]?\d{1,9}$/

Token Breakdown

TokenDescription
^Anchors at the start of the string (or line in multiline mode)
\+Matches a literal plus sign
?Makes the preceding element optional (zero or one times)
\dMatches any digit (0-9)
{1,3}Matches between 1 and 3 times
[\s.-]Character class — matches any one of: \s.-
?Makes the preceding element optional (zero or one times)
\(Matches a literal opening parenthesis
?Makes the preceding element optional (zero or one times)
\dMatches any digit (0-9)
{1,4}Matches between 1 and 4 times
\)Matches a literal closing parenthesis
?Makes the preceding element optional (zero or one times)
[\s.-]Character class — matches any one of: \s.-
?Makes the preceding element optional (zero or one times)
\dMatches any digit (0-9)
{1,4}Matches between 1 and 4 times
[\s.-]Character class — matches any one of: \s.-
?Makes the preceding element optional (zero or one times)
\dMatches any digit (0-9)
{1,9}Matches between 1 and 9 times
$Anchors at the end of the string (or line in multiline mode)

Detailed Explanation

This regex validates international phone numbers in various formats. Here is the token-by-token breakdown:

^ — Anchors the match at the start of the string.

+? — Matches an optional plus sign at the beginning, commonly used before the country code in international dialing format.

\d{1,3} — Matches one to three digits for the country code. Country codes range from one digit (e.g., 1 for US) to three digits (e.g., 358 for Finland).

[\s.-]? — Matches an optional separator (whitespace, dot, or hyphen) after the country code.

(? — Matches an optional opening parenthesis, as some formats enclose the area code in parentheses.

\d{1,4} — Matches one to four digits for the area or city code. Different countries have varying area code lengths.

)? — Matches an optional closing parenthesis.

[\s.-]? — Matches an optional separator.

\d{1,4} — Matches one to four digits for the next part of the phone number.

[\s.-]? — Matches another optional separator.

\d{1,9} — Matches one to nine digits for the remaining part of the number. This generous range accommodates the varying lengths of phone numbers across different countries.

$ — Anchors the match at the end.

International phone numbers vary greatly in length and format. This pattern is intentionally flexible to accommodate numbers from different countries. For strict validation of a specific country, a country-specific pattern is recommended.

Example Test Strings

InputExpected
+44 20 7946 0958Match
+1 (555) 123-4567Match
+81 3-1234-5678Match
++1234No Match
+91 9876 543210Match

Try It — Interactive Tester

//
gimsuy
No matches found.
Pattern: 60 charsFlags: noneMatches: 0

Ctrl+Shift+C to copy regex

Customize this pattern →