Generate country-correct fake phone numbers
This tool builds phone numbers that match a chosen country’s real dialling conventions — the correct ITU country calling code, a plausible national prefix, and the right total length — so they pass front-end format checks. Where a country publishes a reserved fiction block (the UK and US do), the tool uses it so the number can never reach anyone. It is built for testing international phone-input validation, demos, and seed data.
How it works
Every number is expressed in two ways. E.164 is the canonical international form: + then the country code then the national significant number, total length capped at 15 digits. The national format shows the in-country presentation with the trunk prefix (often 0) and typical spacing. For each country the generator stores the calling code, the national number length, a leading subscriber digit pattern, and — for the UK and US — the official reserved fictional range. It then fills the remaining positions with random digits.
Country-specific conventions that trip up validators
International phone validation is harder than it looks because each country has its own rules about length, leading digits, and trunk prefixes. A few examples of where implementations commonly fail:
France (+33). French mobile numbers start with 06 or 07 in national format. The trunk prefix 0 is dropped in E.164, so 06 12 34 56 78 becomes +33612345678. A validator that expects the 0 in E.164 will incorrectly reject it.
Germany (+49). Germany has variable-length national numbers — city codes can be 2 to 5 digits and the subscriber part fills the remaining length. A validator that expects a fixed 10-digit national number will fail on legitimate German numbers.
India (+91). Indian mobile numbers are 10 digits starting with 6, 7, 8, or 9. Landline numbers start with smaller digits and include area codes. A single regex that does not account for this split will accept or reject numbers it should not.
UK (+44). The UK publishes an official fiction block: 07700 900xxx for mobile and 020 7946 0xxx for London landline. Numbers in these ranges are guaranteed never to be allocated to a real subscriber, making them the safest choice for test data.
This generator handles the national-length and prefix rules for each country so the output passes format validation without you having to encode each country’s rules from scratch.
E.164 versus national format
Use E.164 (+countrycode...) when feeding data to:
- SMS APIs (Twilio, Vonage, AWS SNS)
- Phone number validation libraries like Google’s libphonenumber
- International CRM and contact systems
Use national format when:
- Displaying numbers to users in their own country
- Testing a localised UI that formats numbers for a specific locale
Practical tips
- Generate a batch across several countries to stress-test a validator that must accept any valid international number.
- Prefer E.164 for storage; format for display at render time using a library rather than storing pre-formatted strings.
- For countries without a published fiction block, treat generated numbers as format-only stubs — never dial them.
- Pair this with the dedicated US and UK generators when you need the full set of reserved fiction ranges for those countries.