Regex for US phone number
This pattern accepts the common US formats: with or without parentheses around the area code, and with dashes, dots, spaces or no separators.
The pattern
/\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}/gThe tester opens with this pattern and the examples below already loaded. Nothing you type is uploaded.
How it works
\(?\d{3}\)?- Three-digit area code, parentheses optional.
[-.\s]?- Optional dash, dot or space separator.
\d{3}- Three-digit exchange.
\d{4}- Four-digit line number.
Examples
Matches
(415) 555-0132415-555-0132415.555.01324155550132
Does not match
555-013212-345-6789
Use it in JavaScript
const re = /\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}/g;
// Find every match in a block of text
const found = text.match(re);
// Validate that a whole value matches (no stray characters around it)
const exact = new RegExp('^(?:' + re.source + ')$', re.flags.replace('g', ''));
const isValid = exact.test(value);Limits and tips
- It does not enforce that the area code or exchange cannot start with 0 or 1, and it does not handle a +1 prefix.
- It also accepts mismatched parentheses, such as (415 555-0132. Normalise the digits and validate length in code if you need stricter input.
Frequently asked questions
Does it handle the +1 country code?
No. Add (?:\+1[-.\s]?)? at the start to accept an optional +1 prefix.
Is there a pattern for Indian numbers?
Yes, see the Indian mobile number pattern, which handles +91 and the 6–9 starting digit.