Phone number validator
A regex is enough until the first foreign customer signs up. A real check reads the country's numbering plan: which prefixes exist, how long the number should be, and whether it is a mobile or a landline.
Pick the country, or start with + and the international code.
How the check works
- 1
The country decides the rules
Either you pick it from the list, or the leading + tells us. Without one of the two, the same digits mean different things in different countries.
- 2
The number is matched against the numbering plan
Not just the length: each country reserves specific prefix ranges for mobiles, landlines, toll-free and premium numbers.
- 3
Three formats come back
E.164 for storage, international for display, national for a local form. Storing E.164 is what saves you a migration later.
Why store numbers in E.164
E.164 is the one unambiguous form: a plus sign, the country code, the subscriber number, no spaces or punctuation. It sorts, deduplicates and dials without a second thought, whereas '06 12 34 56 78' is meaningless outside France.
Convert at the edges — parse what the user types, display it in their local format — and keep E.164 in the database.
Valid is not reachable
The numbering plan says a number could exist. It does not say a line is connected, a SIM is active, or anyone answers. Only sending something — an SMS, a call — settles that, and it costs money.
Frequently asked questions
What is E.164 format?
The ITU standard for international numbers: a leading +, then up to 15 digits with no spaces or separators. +442079460958 is the E.164 form of 020 7946 0958. It is the only representation that is unambiguous worldwide.
Can I tell a mobile from a landline?
In most countries, yes, because prefix ranges are allocated by type. Some countries do not separate them at all, and number portability blurs the picture further — a number ported from a landline operator can keep its old prefix.
Why is my number valid on one site and not another?
Because the poor implementation used a regex written for one country. /^0[1-9]\d{8}$/ accepts French numbers and rejects every Belgian, Swiss and British one. A proper check uses a maintained numbering-plan database, not a pattern.
The same check over API
This tool runs in your browser. To run the same check from your code, in bulk or server-side, the API answers in JSON.
Read the documentation