Skip to content

Phone Number Generator & Validator | US, UK, Mexico, India

Generate test phone numbers for the US, UK, Mexico, and India in local or E.164 format, then check any number against each country's mobile and landline rules.

Phone Number Generator & Validator

Loading calculator...
πŸ“š

Documentation

What is a phone number generator and validator?

A phone number generator creates phone numbers that follow the formatting rules of a real country without belonging to any real subscriber. This tool generates test phone numbers for the United States, the United Kingdom, Mexico, and India. It can produce a mobile number or a landline number, in local format or in international E.164 format, and it checks the result against that country's numbering rules. It is meant for testing software, not for making real calls or texts.

How the generator builds a number

Every number the tool creates has two parts: a fixed area code and a block of random digits.

  1. Country and region. Each supported country lists four sample regions (for example, in the US: New York, California, Texas, Florida). Each region maps to one real area code, so choosing "California" always gives the area code 213, and choosing "New York" always gives 212.

  2. Mobile or landline. For the UK and India, mobile numbers and landline numbers use different prefixes. For the US and Mexico, this tool uses the same set of area codes for both, since it does not model a separate mobile-only range for those two countries.

  3. Random digits. The tool fills the rest of the number, up to a fixed total length of 10 digits, with random digits. The formula is simple:

    random digits = 10 βˆ’ length of the area code

    For a 2-digit Mexican area code like 55, that is 8 random digits. For a 3-digit US area code like 213, that is 7 random digits.

  4. US exception. US numbers follow the North American Numbering Plan (NANP). After the 3-digit area code, the next 3 digits (the exchange code) must start with a digit from 2 to 9 and cannot be a service code like 911 or 411. The tool enforces this by re-rolling those 3 digits until they pass, then adds 4 more random digits for the line number.

  5. Formatting. The finished digits are grouped and, if international format is selected, prefixed with a plus sign and the country code, following the E.164 pattern.

Supported countries and area codes

CountrySample regions and their fixed area codesTotal digitsMobile prefix rule
United States (+1)New York 212, California 213, Texas 214, Florida 30510Same codes as landline
United Kingdom (+44)London 20, Manchester 161, Birmingham 121, Glasgow 141 (landline); mobile uses 7700–770310Starts with 7
Mexico (+52)Mexico City 55, Guadalajara 33, Monterrey 81, CancΓΊn 99810Same codes as landline
India (+91)Delhi 11, Mumbai 22, Bangalore 80, Chennai 44 (landline); mobile uses one of 6, 7, 8, 910Starts with 6, 7, 8, or 9

All four countries produce a 10-digit national number in this tool. That matches real practice for the US and India, and is a simplification for the UK and Mexico, where real numbering plans allow some variation.

Worked example: a Mexico City mobile number

  1. Country: Mexico (+52). Region: Mexico City, which fixes the area code at 55.
  2. Number type: mobile. Mexico's mobile prefixes match its landline prefixes, so the prefix is still 55.
  3. Random digits needed: 10 βˆ’ 2 = 8. Suppose the tool generates 12345678.
  4. Combined digits: 5512345678.
  5. Grouped by Mexico's format (2-4-4 for a 2-digit area code): 55 1234 5678.
  6. International format adds the country code: +52 55 1234 5678. Local format drops it: 55 1234 5678.

Worked example: a US number and the NANP rule

  1. Country: United States (+1). Region: California, which fixes the area code at 213.
  2. Random digits needed: 10 βˆ’ 3 = 7. The tool rolls a 3-digit exchange code starting with 2–9 that is not an N11 code, then 4 more digits. Suppose it rolls 555 and 0199.
  3. Combined digits: 2135550199.
  4. Grouped in NANP's 3-3-4 style: 213 555 0199.
  5. International format: +1 213 555 0199.

Because the exchange-code rule is enforced during generation, this number will always pass the tool's own validation check.

E.164: the international format

E.164 is the numbering standard set by the International Telecommunication Union (ITU) in 1984. It limits a phone number to 15 digits and requires a plus sign before the country code when writing a number for international use, for example +52 55 1234 5678. Software that stores phone numbers usually prefers E.164 because it removes ambiguity: a number like +15551234567 identifies its country on its own, while a locally written number like (555) 123-4567 does not.

How validation works in this tool

Clicking "Generate" both creates a number and checks it, showing a "valid" or "invalid" mark next to it. The check looks at:

  • Length. The national number must be exactly 10 digits (plus the country code, if written in international format).
  • US exchange and area codes. Both the 3-digit area code and the 3-digit exchange code must start with 2–9 and must not be an N11 code such as 911.
  • India mobile numbers. The first digit must be 6, 7, 8, or 9.
  • UK mobile numbers. The number must start with 7.

Because the generator already builds numbers according to these same rules, a freshly generated number will normally show as valid. The check exists mainly to demonstrate, in a visible way, the same logic a developer would use to validate phone numbers entered by real users.

Frequently asked questions

Are these real phone numbers that can receive calls or texts? No. They are randomly generated and follow the correct format for their country, but they are not assigned to any real subscriber. They may coincidentally match a real number, so they should not be used to place calls or send messages.

What is the difference between international and local format? International format starts with a plus sign and the country code, such as +52 55 1234 5678. Local format leaves the country code out, such as 55 1234 5678, the way someone would dial within that country.

Why do US and Mexican numbers not distinguish mobile from landline, while UK and Indian ones do? This tool uses the same area-code list for mobile and landline numbers in the US and Mexico, so a number generated as "mobile" and one generated as "landline" from the same region can look identical. The UK and India use separate prefix lists for mobile and landline numbers, so those two types look different.

Does this tool store or send the numbers it generates? No. Generation and validation happen in the browser. Nothing is sent to a server or saved after the page is closed.

Can generated numbers be used in a production application? They should be used for development and testing only. They are not verified working numbers and should not be stored as real customer data.

How do I validate phone numbers in my own code? Define a regular expression for each country's format, strip spaces and punctuation from the input, and compare it against the expected length and prefix rules, similar to the checks described above. For production use across many countries, a maintained library such as Google's libphonenumber handles far more edge cases than a hand-written regular expression.