Regex for US Phone Number
This regex matches US phone numbers in a variety of common formats including with or without country code, parentheses around the area code, and dashes, dots, or spaces as separators. It handles formats like (555) 123-4567, 555-123-4567, 5551234567, and +1 555 123 4567. The pattern is flexible enough for user input while still enforcing the 10-digit US format.
^\+?1?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$ What is the regex pattern for US Phone Number?
The regex pattern for US Phone Number is ^\+?1?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$. This regex matches US phone numbers in a variety of common formats including with or without country code, parentheses around the area code, and dashes, dots, or spaces as separators. It handles formats like (555) 123-4567, 555-123-4567, 5551234567, and +1 555 123 4567. The pattern is flexible enough for user input while still enforcing the 10-digit US format. This pattern is commonly used for phone number form validation and contact data extraction.
Test Examples
(555) 123-4567 (555) 123-4567 555-123-4567 555-123-4567 +1 555 123 4567 +1 555 123 4567 Common Uses
- ✓ Phone number form validation
- ✓ Contact data extraction
- ✓ CRM data cleaning
- ✓ User registration forms
Variations
Strict 10 digits
^\d{10}$ Only matches exactly 10 consecutive digits
With extension
^\+?1?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}(\s*(ext|x|ext.)\s*\d{1,5})?$ Allows extensions like ext. 1234
Dashes only
^\d{3}-\d{3}-\d{4}$ Only 555-123-4567 format
Frequently Asked Questions
Does this regex validate that the phone number actually exists?
No, it only checks the format. Valid formatting does not guarantee the number is assigned or active. Use a phone validation API for deliverability checks.
Can this match toll-free numbers?
Yes, toll-free numbers like 1-800-555-0199 follow the same 10-digit format and are matched by this pattern.
Why allow so many separator formats?
Users enter phone numbers in many different ways. Allowing dashes, dots, spaces, and parentheses reduces form validation friction and improves user experience.