DevBolt

Phone Number Regex Pattern & Tester

Test phone number validation regex patterns with real-time matching. Copy regex patterns for US numbers, international formats, and various phone number styles.

← Back to tools

Regex Tester

Test regular expressions in real time with match highlighting and capture groups.

//g

Matches (0)

Enter a pattern and test string to see matches

US phone number regex

Match US phone numbers in various formats: ^\+?1?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$ — this handles formats like (555) 123-4567, 555-123-4567, +1 555 123 4567, and 5551234567. It allows optional country code, parentheses, hyphens, dots, and spaces.

International phone number regex

For international numbers: ^\+[1-9]\d{1,14}$ (E.164 format) matches numbers like +14155551234 and +442071234567. For user-facing input that allows formatting: ^\+?\d{1,4}[-.\s]?\(?\d{1,4}\)?[-.\s]?[\d-.\s]{4,15}$ handles most international formats with optional formatting characters.

Frequently Asked Questions

What regex matches all phone number formats?

No single regex perfectly matches all global phone formats. For best results, use E.164 format (^\+[1-9]\d{1,14}$) as a storage standard, and a lenient regex for input validation. Libraries like libphonenumber provide the most accurate validation.

How do I validate phone numbers in JavaScript?

Use regex for basic format checking: /^\+?1?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(phone). For production validation, use the google-libphonenumber library which handles international formats and carrier validation.