RegexCalc Regex Engine

Phone Number Regex

A phone number pattern covering compact E.164 numbers and the common US formats, pre-loaded in the tester. Below it, a table shows what it accepts and rejects, and what to normalise before you test.

Regular Expression JAVASCRIPT REGEX
/ / gm
Match Status
2 matches found
Pattern Valid
Recipes:
Test String
Extracted Matches

What this phone number pattern accepts and rejects

The pattern has two alternatives joined by |: a compact international form (an optional +, a first digit 1-9, then up to 14 more digits, as in E.164) and the US forms (555) 234-5678 and 555-987-6543. It checks shape only: it does not strip spaces, and it cannot tell whether a number exists.

Each input below was tested on its own against the pattern above when this page was built, with no flags, so ^ and $ anchor the whole value. Paste any of them into the tester to see the same result.

InputResultWhy it matters
+16176803278MatchesE.164: plus sign, country code and number, no separators.
(555) 234-5678MatchesUS form with parentheses.
(555)234-5678MatchesThe space after the area code is optional.
555-987-6543MatchesUS form with dashes.
5552345678MatchesTen bare digits pass through the international alternative, because the plus sign is optional.
12MatchesAccepted: that alternative allows as few as two digits, so a match alone does not prove a usable number. Add a minimum length if that matters.
+44 20 7946 0958No matchRejected: international numbers are usually written with spaces, and the pattern does not allow them. Strip spaces before testing.
555.234.5678No matchRejected: dots are not an accepted separator.
1-555-234-5678No matchRejected: a leading 1- country code is not part of the US alternative.
+0123456No matchRejected: country codes never start with 0.

More from RegexCalc

Guides

All tools →All 13 guides →

Frequently Asked Questions

Why does this regex reject +44 20 7946 0958?

Because the international alternative allows digits only, and international numbers are usually written with spaces. Remove spaces, dots and dashes before testing: the same number written as +442079460958 matches.

Does a match mean the phone number is real?

No. The pattern checks shape only: its international alternative accepts anything from 2 to 15 digits, so even 12 matches. Use a phone number library or a confirmation code if the number has to work.

Developer Sponsor / Partner
Copied to clipboard!