Regex Phone Number Patterns — US, International, and E.164
💡Phone number regex depends on the format you're targeting. US format: ^(\+1[-\s.]?)?(\(\d{3}\)|\d{3})[-\s.]?\d{3}[-\s.]?\d{4}$. E.164 international standard: ^\+[1-9]\d{6,14}$. For strict validation across countries, use a library like libphonenumber instead of regex. Test patterns with the Regex Tester.
Pattern Examples
Simple US 10-digit
❌ Wrong
/\d{10}/ // too loose — matches any 10 digits✅ Fixed
/^\d{3}[-.]?\d{3}[-.]?\d{4}$/
// Matches: 5551234567, 555-123-4567, 555.123.4567^ and $ anchors ensure the entire string matches, not just part of it.
US with optional country code
❌ Wrong
/\+1\d{10}/ // requires country code✅ Fixed
/^(\+1[-.\s]?)?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/
// Matches: 555-123-4567 AND +1-555-123-4567(\+1[-.\s]?)? makes the country code optional. \(? and \)? make parentheses optional.
E.164 international
❌ Wrong
/\+\d+/ // too loose✅ Fixed
/^\+[1-9]\d{6,14}$/
// Matches: +12025551234, +447911123456
// Rejects: +0123456789 (invalid country code)[1-9] prevents leading zero country codes. {6,14} covers shortest to longest valid numbers.
Any international format
❌ Wrong
/[\d\s\+\-\(\)]+/ // matches too much✅ Fixed
/^[+]?[(]?[0-9]{3}[)]?[-\s.]?[0-9]{3}[-\s.]?[0-9]{4,6}$/
// Loose validation for international numbersLoose pattern for general international use when exact format is unknown.
Test Your Pattern
Real-World Usage
US phone number form validation
const US_PHONE = /^(\+1[-.\s]?)?(\(\d{3}\)|\d{3})[-.\s]?\d{3}[-.\s]?\d{4}$/;
// Accepts: (555) 123-4567, 555-123-4567, +1 555 123 4567Flexible pattern accepts common US formats with optional country code.
E.164 for international SMS APIs
const E164 = /^\+[1-9]\d{6,14}$/;
// +12025551234, +447911123456
// Required by Twilio, Vonage, and most SMS APIsE.164 is the international standard: + followed by country code and subscriber number, no spaces.
Strip formatting before validation
const raw = '(555) 123-4567';
const digits = raw.replace(/\D/g, ''); // '5551234567'
const valid = /^1?\d{10}$/.test(digits); // trueStrip non-digits first, then validate digit count. Simpler than matching all possible formats.
Related Guides
- → Regex Email Pattern
- → Regex URL Pattern
- → Regex Password Validation
- → Regex Numbers Only Pattern
- → Common Regex Patterns
- → Regex Date Format
Frequently Asked Questions
Is regex the best way to validate phone numbers?
For simple cases yes. For production international phone validation, use libphonenumber-js — it handles country-specific rules, carrier codes, and formatting that regex can't.
What is E.164 format?
E.164 is an international standard: country code + subscriber number, no spaces or punctuation, max 15 digits. Format: +12025551234. Required by most SMS and telephony APIs.
How do I extract phone numbers from text?
Use a loose pattern without anchors: /[+]?[1-9][\d\s.-]{6,14}\d/g. Extracting from unstructured text needs looser matching than form validation.
All tools run in your browser. Your data never leaves your device.