DevBolt
Processed in your browser. Your data never leaves your device.

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 as separators between digit groups.

// JavaScript — validate US phone numbers
const usPhone = /^\+?1?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/;

usPhone.test("(555) 123-4567");   // true
usPhone.test("555-123-4567");      // true
usPhone.test("+1 555 123 4567");   // true
usPhone.test("5551234567");        // true

# Python
import re
pattern = r"^\+?1?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$"
re.match(pattern, "(555) 123-4567")  # Match

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. For production validation, consider using the libphonenumber library instead of regex alone.

// E.164 format — the international standard for phone storage
const e164 = /^\+[1-9]\d{1,14}$/;

e164.test("+14155551234");    // true  (US)
e164.test("+442071234567");   // true  (UK)
e164.test("+81312345678");    // true  (Japan)
e164.test("14155551234");     // false (missing +)

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.

Related Inspect Tools