Safe Fake Data: Reserved Domains, Phone Numbers and IPs for Testing
Which email domains, phone numbers, IP addresses and card numbers are reserved for examples and tests, so fake data never reaches a real person or server.
A developer seeds a staging database with made-up users. One of them is [email protected], another has the phone number (212) 555-2368. Months later a misconfigured job sends a password reset to every user in staging. mail.com is a real email provider, so the reset goes to a real inbox, and the phone number could just as easily have belonged to someone who now gets texts from a company they never heard of.
Fake data is only safe if it cannot reach anything real. For the most common kinds of data, there are values set aside for exactly this purpose: domains, phone numbers and IP addresses that are guaranteed never to belong to anyone. This post lists them, and what to do for the kinds of data that have no reserved range.
The generator below uses these reserved values for every row it produces, and outputs JSON, CSV or SQL INSERT statements.
Email addresses and domains
RFC 2606, later extended by RFC 6761, reserves domain names that will never be assigned to anyone:
| Name | Intended use |
|---|---|
example.com, example.net, example.org | Documentation and examples |
.example | Documentation, as a top-level domain |
.test | Testing |
.invalid | Names that must never resolve |
.localhost | The local machine |
[email protected] is the safe default for fake email addresses. The domain does exist and serves a short page from IANA, but it publishes a "null MX" record (MX 0 ., defined in RFC 7505), which tells mail servers that it accepts no email. A well-behaved server rejects the message immediately instead of retrying.
Use .invalid when an address must never be deliverable at all, such as in a test that checks a bounce is handled. A name like [email protected] cannot resolve in DNS, so no mail server will even try.
The same applies to URLs in fixtures and documentation: https://api.example.com/v1/users is safe, while https://api.myapp-test.com may one day belong to someone else.
Phone numbers
In the North American Numbering Plan (the US, Canada and several Caribbean countries), only 555-0100 to 555-0199 are reserved for fictional use. They are valid in any area code, so +1 212 555 0123 is a safe New York number.
Most other 555 numbers are not fictional. The range was gradually opened for real assignment, and 555-1212 has long been directory assistance. A random 555-xxxx is therefore not guaranteed to be safe; only 555-01xx is.
Other countries have their own ranges. The UK regulator Ofcom reserves numbers for drama and examples, including:
| Type | Reserved range |
|---|---|
| London | 020 7946 0000 to 020 7946 0999 |
| Mobile | 07700 900000 to 07700 900999 |
| Geographic, no specific city | 01632 960000 to 01632 960999 |
For other countries, check the national numbering authority. Where no fictional range exists, the safest option is a number in a format the country has never allocated, so it fails validation in any real system as well.
IP addresses
RFC 5737 sets aside three IPv4 blocks for documentation. They are never routed on the public internet:
| Block | Name |
|---|---|
192.0.2.0/24 | TEST-NET-1 |
198.51.100.0/24 | TEST-NET-2 |
203.0.113.0/24 | TEST-NET-3 |
For IPv6, RFC 3849 reserves 2001:db8::/32, and RFC 9637 added 3fff::/20 for examples that need a larger range.
Two common shortcuts are worse than they look. 1.2.3.4 and 8.8.8.8 are real, routed addresses, so a load test or a firewall rule written against them affects someone else's network. Private ranges such as 10.0.0.0/8 and 192.168.0.0/16 are not routed publicly, but they are real addresses on someone's LAN, often including the machine running your tests. Use private ranges when you need a working local network and the documentation blocks when the address is just a value in a field.
Card numbers
Never put a real card number in a test, and do not generate random numbers that pass the Luhn check: some of them will be real cards. Every payment processor publishes test card numbers that work only in its test mode, such as Stripe's 4242 4242 4242 4242. 4111 1111 1111 1111 is a widely used Visa test number, recognised as a test card by many gateways.
Using the processor's own test numbers also lets you trigger specific outcomes. Most publish separate numbers for declined cards, insufficient funds or a required 3-D Secure step, which random digits cannot do.
Data with no reserved range
There is no reserved range for names, street addresses or most national ID numbers, so the goal shifts from "guaranteed fake" to "clearly fake and never copied from production".
- Names. Any common name belongs to thousands of real people, and that is fine as long as it is not paired with real contact details. The risk comes from combining a name with a real email or phone number.
- Street addresses. Use clearly fictional street names together with a reserved phone number and an
example.comemail. A real-looking address on its own is harmless; a complete, contactable identity is not. - US Social Security numbers. Numbers starting with
000or666, with group00, or with serial0000are never issued, and numbers starting with9are not issued as SSNs (the IRS uses that range for taxpayer numbers, but never with group00). A test SSN such as900-00-0001therefore cannot belong to anyone. The cautionary tale is078-05-1120, a real number printed on a sample card sold in wallets in 1938, which thousands of people then used as their own.
Making fake data useful
Safe data still needs to exercise your code. A few habits make fixtures catch more bugs:
- Include awkward names.
O'Brienbreaks unescaped SQL,JoséandZoëtest encoding, and a single-word name tests code that assumes a first and last name. - Vary lengths. Very short and very long values find truncation bugs and broken layouts that average values never hit.
- Use realistic volumes. Pagination, slow queries and memory problems only show up with thousands of rows, not five.
- Keep it deterministic where tests depend on it. Random data is good for exploring; a test that asserts on a specific value needs a fixed fixture or a seeded generator, or it will fail at random.
Quick reference
| Data | Safe values | Avoid |
|---|---|---|
[email protected], [email protected] | Invented domains like test.com | |
| URL | https://example.com/..., *.test | Made-up company domains |
| Phone (US/Canada) | 555-0100 to 555-0199, any area code | Other 555 numbers |
| Phone (UK) | 07700 900xxx, 020 7946 0xxx | Random mobile numbers |
| IPv4 | 192.0.2.x, 198.51.100.x, 203.0.113.x | 1.2.3.4, 8.8.8.8 |
| IPv6 | 2001:db8::/32, 3fff::/20 | Real prefixes |
| Card number | Your processor's test numbers | Random Luhn-valid numbers |
| US SSN | Group 00, e.g. 900-00-0001 | Anything that could be issued |
