Check numbers
Runs in this tab. The page cannot send what you paste: its Content-Security-Policy has connect-src 'none', and nothing is stored. Number ranges: libphonenumber v9.0.44 metadata of 2026-11-18, 254 regions.
One number per line, up to 500 lines. tel: links, full-width digits and extensions are recognised; extensions are reported, since E.164 has no place for them. When more than one number is valid, the clean list at the bottom is ready to copy into a fixture file.
What E.164 is
E.164 is the ITU-T numbering plan for international phone numbers. Written for machines, a number is a +, the country code, then the national number, with nothing in between:
| Part | Rule | Example |
|---|---|---|
+ | always first; it stands for whatever international prefix the caller's network uses (00, 011) | + |
| Country code | 1 to 3 digits, never starts with 0 | 44 |
| National number | the rest, without the national trunk prefix (0 in the UK, Indonesia, Germany) | 7400123456 |
| Total | 15 digits at most, country code included | +447400123456 |
There are no spaces, dashes, brackets or extensions in E.164. Those belong to the display format, which differs by country and is only for people.
The regex, and what it misses
# handler_api reference: https://otpwatch.com/e164-format-checker
# Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
^\+[1-9]\d{1,14}$The pattern checks the shape: a +, a first digit that is not 0, and 2 to 15 digits in total. It accepts any digits that fit that shape, so it says yes to an unassigned country code (+999…), to a number that is too short for its country and to a range nobody has issued. The checker above goes one step further: it finds the country code, then tests the national number against the ranges of that country from the libphonenumber metadata. That is how it tells +447400123456 (a UK mobile range) from +44791 (too short for the UK).
For a sign-up form or a test fixture, the regex is usually enough as the storage rule, with a full library check on input. In code that means libphonenumber or one of its ports; the regex alone is the right tool for the database constraint.
Normalise before you validate
Most numbers that fail are fine numbers in the wrong dress. Clean them in this order, then run the regex:
// handler_api reference: https://otpwatch.com/e164-format-checker
// Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
const E164 = /^\+[1-9]\d{1,14}$/;
export function toE164(raw) {
let s = String(raw).trim().replace(/^tel:/i, "").replace(/[\s\-.()\/]/g, "");
if (s.startsWith("00")) s = "+" + s.slice(2);
else if (!s.startsWith("+")) s = "+" + s; // digits that already start with the country code
return E164.test(s) ? s : null;
}
// toE164("00 44 7400 123456") === "+447400123456"# handler_api reference: https://otpwatch.com/e164-format-checker
# Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
import re
E164 = re.compile(r"\+[1-9]\d{1,14}")
def to_e164(raw: str) -> str | None:
s = re.sub(r"[\s\-.()/]", "", raw.strip().removeprefix("tel:"))
if s.startswith("00"):
s = "+" + s[2:]
elif not s.startswith("+"):
s = "+" + s # digits that already start with the country code
return s if E164.fullmatch(s) else None// handler_api reference: https://otpwatch.com/e164-format-checker
// Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
using System.Text.RegularExpressions;
public static partial class E164
{
[GeneratedRegex(@"^\+[1-9]\d{1,14}$")]
private static partial Regex Shape();
[GeneratedRegex(@"[\s\-.()/]")]
private static partial Regex Punct();
public static string? Normalize(string raw)
{
var s = Punct().Replace(raw.Trim(), "");
if (s.StartsWith("00")) s = "+" + s[2..];
else if (!s.StartsWith('+')) s = "+" + s;
return Shape().IsMatch(s) ? s : null;
}
}// handler_api reference: https://otpwatch.com/e164-format-checker
// Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
package e164
import (
"regexp"
"strings"
)
var (
shape = regexp.MustCompile(`^\+[1-9]\d{1,14}$`)
punct = regexp.MustCompile(`[\s\-.()/]`)
)
func Normalize(raw string) (string, bool) {
s := punct.ReplaceAllString(strings.TrimSpace(raw), "")
switch {
case strings.HasPrefix(s, "00"):
s = "+" + s[2:]
case !strings.HasPrefix(s, "+"):
s = "+" + s
}
return s, shape.MatchString(s)
}<?php
// handler_api reference: https://otpwatch.com/e164-format-checker
// Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
function to_e164(string $raw): ?string
{
$s = preg_replace('/[\s\-.()\/]/', '', trim($raw));
if (str_starts_with($s, '00')) {
$s = '+' . substr($s, 2);
} elseif (!str_starts_with($s, '+')) {
$s = '+' . $s;
}
return preg_match('/^\+[1-9]\d{1,14}$/', $s) ? $s : null;
}Two cases the snippets deliberately do not guess. A national number such as 07400 123456 has no country code, so +07400123456 fails the regex: ask for the country or take it from the form's country picker. And +44 07400 123456, the trunk 0 left in after the country code, passes the regex but dials nowhere; the checker above catches it from the ranges and drops the 0.
Numbers from handler_api.php
getNumber returns the number as digits that start with the country code, without the +: ACCESS_NUMBER:<id>:<number>. Add + in front and it is E.164, which is what the client pages do in their e164 helper. Paste a batch of returned numbers into the checker to see the country and type of each range before you wire them into a test.
Common mistakes
| Input | What is wrong | E.164 |
|---|---|---|
0044 7400 123456 | 00 is a dialing prefix, and spaces | +447400123456 |
+44 (0) 7400 123456 | the (0) trunk prefix is display-only | +447400123456 |
+1-415-555-2671 | dashes | +14155552671 |
6281234567890 | no + (fine in storage only if every number in the column has its country code) | +6281234567890 |
081234567890 | a national number: no country code to add + to | ask for the country |
+1 415 555 2671 ext. 12 | an extension | +14155552671, extension stored apart |
What the number type means
The type (mobile, fixed line, toll free, VoIP and so on) comes from the range the number belongs to, as the libphonenumber metadata lists it. Two facts shape it:
- +1 does not say. In the United States, Canada and the other +1 countries, mobile and fixed numbers share the same ranges, so the checker answers "fixed line or mobile". Some other countries are the same.
- Ranges move with porting. A number moved to another network keeps its digits. The range says who issued it, not what the line is today.
If a flow under test refuses some numbers as "not mobile", the range type is the first thing to look at, and the second is the country the form expects.
Where the ranges come from
The checker uses the PhoneNumberMetadata.xml file of Google's libphonenumber project (Apache License 2.0): release v9.0.44, file last changed on 18 November 2026, 254 regions under 215 country codes. The file is converted at build time into the table this page loads; the checker itself is the site's own code and makes no network requests.