Back to Home

US Phone Number Validation Regex (Standard Format)

CronOS Team
regexphonevalidationtutorialus-phone

Need to generate a regex pattern?

Use CronOS to generate any regex pattern you wish with natural language. Simply describe what you need, and we'll create the perfect regex pattern for you. It's completely free!

Generate Regex Pattern

US Phone Number Validation Regex (Standard Format)

Learn how to validate US phone numbers in standard formats with optional parentheses, dashes, dots, and spaces using regex.

Pattern Breakdown

regex
^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$

Components

ComponentDescriptionMatches
^Start anchorEnsures match from string start
\(?Optional opening parenthesisOptional ( character
\d{3}Area codeExactly 3 digits
\)?Optional closing parenthesisOptional ) character
[-.\s]?Optional separatorOptional dash, dot, or space
\d{3}Exchange codeExactly 3 digits
[-.\s]?Optional separatorOptional dash, dot, or space
\d{4}Subscriber numberExactly 4 digits
$End anchorEnsures match to string end

Character Classes

  • \( - Literal opening parenthesis (escaped)
  • \) - Literal closing parenthesis (escaped)
  • \d - Any digit (0-9)
  • [-.\s] - Character class: dash, dot, or whitespace
  • ? - Quantifier: zero or one occurrence (optional)
  • {3} - Quantifier: exactly 3 occurrences
  • {4} - Quantifier: exactly 4 occurrences

Examples

Valid:

  • (555) 123-4567
  • 555-123-4567
  • 555.123.4567
  • 5551234567
  • (555)123-4567
  • 555 123 4567
  • (555) 123.4567

Invalid:

  • 555-123-456 (missing last digit)
  • (555-123-4567 (mismatched parentheses)
  • 55-123-4567 (area code too short)
  • 555-12-4567 (exchange code too short)
  • 555-123-45678 (subscriber number too long)
  • +1-555-123-4567 (country code not supported)

Implementation

JavaScript

javascript
const phoneRegex = /^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/;
phoneRegex.test('(555) 123-4567'); // true
phoneRegex.test('555-123-4567'); // true
phoneRegex.test('5551234567'); // true
phoneRegex.test('555-123-456'); // false (too short)

Python

python
import re
phone_regex = r'^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$'
bool(re.match(phone_regex, '(555) 123-4567'))  # True
bool(re.match(phone_regex, '555-123-4567'))  # True
bool(re.match(phone_regex, '5551234567'))  # True

Go

go
phoneRegex := regexp.MustCompile(`^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$`)
phoneRegex.MatchString("(555) 123-4567") // true
phoneRegex.MatchString("555-123-4567") // true
phoneRegex.MatchString("5551234567") // true

Limitations

  1. No country code: Doesn't support +1 prefix
  2. Mismatched parentheses: Allows (555-123-4567 (opening without closing)
  3. No extension support: Doesn't handle extensions like x1234
  4. No validation of area codes: Accepts invalid area codes like 000
  5. Mixed separators: Allows mixed formats like (555) 123.4567

When to Use

  • US phone number input forms
  • Client-side validation for common US formats
  • When you want to accept multiple formatting styles
  • Quick format checking

For production, consider:

  • Adding country code support: ^(\+1[-.\s]?)?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$
  • Validating area codes against known valid ranges
  • Normalizing phone numbers before storage
  • Server-side validation

Need to generate a regex pattern?

Use CronOS to generate any regex pattern you wish with natural language. Simply describe what you need, and we'll create the perfect regex pattern for you. It's completely free!

Generate Regex Pattern