validation
US Phone Number Regex Pattern
Validates US phone numbers in the common formats: with/without country code (+1 or 1), with/without parentheses around the area code, and using spaces, dots, or dashes as separators.
/^\+?1?[\s.-]?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$/ What each part matches
^\+?1? — optional '+1' or '1' country code[\s.-]? — optional separator (space, dot, or dash)\(?\d{3}\)? — 3-digit area code, optional parens\d{3}[\s.-]?\d{4}$ — 3 + 4 digit local number✓ These match
- (555) 123-4567
- 555-123-4567
- +1 555 123 4567
- 5551234567
✗ These don't
- 555-12-34567
- (555)1234567 ext 100
- 123-4567
Use in your code
JavaScript
const re = /^\+?1?[\s.-]?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$/;
re.test(input); // → true or false Python
import re
re.fullmatch(r"^\+?1?[\s.-]?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$", input) PHP (PCRE)
preg_match('/^\+?1?[\s.-]?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$/', $input); Go
re := regexp.MustCompile(`^\+?1?[\s.-]?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$`)
re.MatchString(input) FAQ
Does this us phone number regex work in JavaScript?
Yes. Every pattern in the Utilko regex library is tested to work in JavaScript RegExp, PCRE (PHP, Nginx), and Python `re`. Where flavor matters (lookbehind, named groups), the pattern page flags it.
How do I use this pattern?
Copy the pattern from the code block above. In JavaScript:
new RegExp('^\+?1?[\s.-]?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$') or literal /^\+?1?[\s.-]?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$/. Or click "Try in regex tester" to open it pre-loaded in Utilko's browser-based regex tester.Should I use this for security-critical validation?
Client-side regex is fine for UX (immediate feedback on a form). For anything security-critical — payments, auth, data integrity — always re-validate server-side using the same pattern PLUS domain-specific checks (Luhn checksum for cards, actual email delivery test, DNS resolution for domains).