DevKits

Validation

Match a US phone number

Match US phone numbers in a variety of common formats.

Pattern

Regular expression

(?:\+?1[-. ]?)?\(?[2-9][0-9]{2}\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}

How it works

Accepts optional `+1` country code, optional parentheses on area code, and `-`, `.`, or spaces as separators. Area code and exchange must start with 2–9 (US telephone number rules).

Matches

  • (415) 555-2671
  • 415-555-2671
  • +1 415 555 2671
  • 4155552671

Non-matches

  • 555-1234
  • 1-100-555-5555 (invalid area code)

Common gotchas

For international phone numbers, this pattern will not work. Use Google's `libphonenumber` library (`phonenumbers` in Python, `libphonenumber` in JS/Go/Java) for full E.164 handling.

Language snippets

JavaScript

const re = /(?:\+?1[-. ]?)?\(?[2-9][0-9]{2}\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}/g;

Python

re.findall(r"(?:\+?1[-. ]?)?\(?[2-9][0-9]{2}\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}", text)

Go

re := regexp.MustCompile(`(?:\+?1[-. ]?)?\(?[2-9][0-9]{2}\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}`)

Java

Pattern.compile("(?:\\+?1[-. ]?)?\\(?[2-9][0-9]{2}\\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}")

Frequently asked questions

What is the regex for US phone number?

The pattern (?:\+?1[-. ]?)?\(?[2-9][0-9]{2}\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4} matches US phone number. Accepts optional `+1` country code, optional parentheses on area code, and `-`, `.`, or spaces as separators. Area code and exchange must start with 2–9 (US telephone number rules).

What does this US phone number pattern match?

It matches strings like (415) 555-2671, 415-555-2671, +1 415 555 2671, but rejects 555-1234, 1-100-555-5555 (invalid area code).

How do I use this pattern in JavaScript, Python, Go, Java?

Ready-to-run snippets are provided for JavaScript, Python, Go, Java. Copy the one for your language from the Language snippets section — each wraps the same core pattern in that language's regex API.

What are common pitfalls with a US phone number regex?

For international phone numbers, this pattern will not work. Use Google's `libphonenumber` library (`phonenumbers` in Python, `libphonenumber` in JS/Go/Java) for full E.164 handling.

Related patterns

Try this pattern in a tool

Try any pattern live in the Regex Tester