Start free · Free tools · Fair usage limits
Browse Tools

Categories

Custom AI Solutions – AI2Flows
LIVE NEWS
Loading latest AI & SEO news…
Home›Tools›Regex Tester›Regex for international phone number (E.164)
Regex pattern · validation

Regex for international phone number (E.164)

Regex for international phone number: a tested pattern with examples, a plain-English breakdown, and code for JavaScript, Python, PHP, Java and Go.

Quick answer

Use /^\+[1-9]\d{1,14}$/ as an international phone number (E.164) regex. It matches "+14155552671" and "+442071838750", and rejects "14155552671" and "+0123456". E.164 has no spaces or punctuation.

Last updated · Maintained by FreeAIToolz · How we test

/^\+[1-9]\d{1,14}$/
  • +14155552671matches
  • +442071838750matches
  • +923001234567matches
  • 14155552671no match
  • +0123456no match
  • +1 415 555 2671no match
  • +1234567890123456no match
Open in the full Regex Tester (replace, flags, groups) →

How this regex works

PartMeaning
^\+a leading plus sign
[1-9]country codes never start with 0
\d{1,14}$up to 15 digits in total

Examples

InputResult
+14155552671✓ Matches
+442071838750✓ Matches
+923001234567✓ Matches
14155552671✗ No match
+0123456✗ No match
+1 415 555 2671✗ No match
+1234567890123456✗ No match

Every example above is checked automatically in JavaScript and Python each time the site is built.

Limitations and edge cases

E.164 has no spaces or punctuation. Strip formatting first. The pattern checks length and shape, not whether a number exists.

When to use this pattern

Storing phone numbers for SMS and WhatsApp APIs (Twilio, Meta), which expect E.164.

Use it in your language

JavaScript

const re = /^\+[1-9]\d{1,14}$/;
re.test(input); // true or false

Python

import re
pattern = re.compile(r'^\+[1-9]\d{1,14}$')
bool(pattern.search(value))

PHP

$ok = preg_match('~^\\+[1-9]\\d{1,14}$~', $value) === 1;

Java

Pattern pattern = Pattern.compile("^\\+[1-9]\\d{1,14}$");
boolean ok = pattern.matcher(value).find();

Go

re := regexp.MustCompile(`^\+[1-9]\d{1,14}$`)
ok := re.MatchString(value)

More regex patterns

Frequently asked questions

What is the regex for international phone number (E.164)?
/^\+[1-9]\d{1,14}$/. E.164 has no spaces or punctuation. Strip formatting first. The pattern checks length and shape, not whether a number exists.
Which languages does this pattern work in?
It is tested in JavaScript and Python and uses syntax that also works in PHP (PCRE) and Java. It also works in Go’s RE2 engine.
Why does the pattern start with ^ and end with $?
They anchor the match to the whole string, so "abc+14155552671xyz" cannot pass just because it contains a valid part. To search for matches inside longer text, remove ^ and $ (use \b where word boundaries help) and add the g flag.