Learning & reference

Example domains for testing: which to use, and how each one behaves

A handful of domain names are reserved so they can never belong to anyone. They are not interchangeable: one resolves and serves a real page, one never resolves, one always points at your own machine. Pick the one whose behaviour your test expects.

The reserved names

NameReserved byWhat happens when you resolve itUse it for
.testRFC 2606, RFC 6761Not delegated in the public DNS, so nothing on the internet answers.Test fixtures. The safe default for addresses and hostnames in tests.
example.com example.net example.orgRFC 2606Resolves, and serves a real page run by IANA.Documentation and screenshots. Not for tests that make requests.
.exampleRFC 2606, RFC 6761Not delegated.Documentation where the example.com family reads wrongly.
.invalidRFC 2606, RFC 6761Resolvers should always answer that the name does not exist.Tests that need a lookup to fail.
.localhostRFC 2606, RFC 6761Should resolve to your own machine's loopback address.Local development: app.localhost, api.localhost.
home.arpaRFC 8375Resolved only inside a home network.Home-network device names.
.altRFC 9476 (2023)Never looked up in DNS at all.Names from non-DNS systems. Rarely what a test needs.

Test suites that call example.com are sending real traffic. The domain is real and hosted, so a test that fetches it in a loop is hitting someone else's server, and it will fail whenever your CI has no internet access. Point request tests at .test names you control locally, or at a mock server.

Names that look safe and are not

NameThe problem
.localReserved for multicast DNS (RFC 6762). Lookups go out to the local network, and macOS, Windows and Linux handle it differently. Slow or failing resolution is the usual symptom.
.devA real top-level domain. The whole namespace is HSTS-preloaded, so browsers force HTTPS on every .dev address. Local setups using it broke when that happened.
.appAlso a real, HSTS-preloaded top-level domain.
test.com, mail.com, domain.comRegistered domains owned by real companies. Mail sent to them in a test is mail sent to a stranger.
company.internalReserved for private use by ICANN in 2024. Fine inside your own network, but it is not a test domain and will not resolve anywhere else.

Email addresses to test a validator with

All on reserved domains, so none can reach anyone. Each is a case real users produce, or a case your validator must refuse.

AddressShould beWhy it is here
jordan@example.testAcceptedThe baseline.
jordan+orders@example.testAcceptedPlus addressing. Rejecting it is the most common validator bug.
o'brien@example.testAcceptedAn apostrophe is legal, and a real surname.
Jordan.Pike@Example.TestAcceptedThe domain is case-insensitive. Compare lowercase domains when checking for duplicates.
jordan@sub.dept.example.testAcceptedSeveral subdomain levels.
josé@example.testYour decisionInternationalised local part (RFC 6531). Valid, but only if your mail path supports it.
"jordan pike"@example.testYour decisionA quoted local part with a space. Legal, rare, and often refused on purpose.
jordan@[192.0.2.1]Your decisionAn address literal. Legal, almost never wanted.
jordan@exampleUsually refusedNo dot in the domain. Legal in theory; nearly always a typo.
jordan..pike@example.testRefusedTwo dots in a row in an unquoted local part.
.jordan@example.testRefusedA local part cannot start with a dot.
jordan@example.test.Refused, or trimmedA trailing dot. Valid in DNS, surprising in a form.
jordan @example.testRefusedAn unquoted space.

Some validators refuse .test itself, because they check the domain against the list of public top-level domains and .test is deliberately not on it. If yours does, your test data cannot pass through it. Decide which you want: accept reserved test domains in non-production environments, or refuse them everywhere and use example.com in fixtures.

Questions

What domain should I use for test email addresses?

A name under .test, such as user@example.test. It is reserved, not delegated, and mail to it cannot be delivered.

What is the difference between example.com and .test?

example.com is a real domain that resolves and serves a page. .test is not delegated at all. Use example.com in docs and .test in anything that sends requests or mail.

Can I use .local for development?

Best avoided: it is reserved for multicast DNS. Use .test, or .localhost for names that point at your own machine.

Why does my .dev domain force HTTPS?

.dev is a real, HSTS-preloaded top-level domain. Browsers upgrade every .dev address to HTTPS. Use .test or .localhost.

Which domain is guaranteed not to resolve?

.invalid. Resolvers should always answer that it does not exist.

Keep going

All safe test data Reserved IP addresses → Email test files →

More from Learning

Guides and references for test data, file handling and AI evals. All free, no sign-up. See the full hub.

Synthetic data for AI evalsWhat you can download, what you buildRAG test corpusDocuments with extraction trapsJSONL for evalsThe format, and ten ways it breaksMock API for agentsRecords, pagination, failures on demandSafe test dataReserved domains, IPs, numbers & cardsSynthetic PIIFake people that reach nobodyTest card numbersEvery brand, declines, 3D SecureTest phone numbersReserved US, UK and Australian rangesReserved IP addressesDocumentation ranges and SSRF casesQA test stringsUnicode, emoji, injection & edge casesFilename compatibilityWhat breaks across Windows, Mac & LinuxFile systemsPOSIX, NTFS, APFS, ext4, SMB, NFS, NASFile signaturesMagic numbers that identify every formatCharacter encodingsUTF-8, UTF-16, BOM & normalizationUpload validationThe checklist, with a file for each checkMIME typesThe right Content-Type for every extensionHTTP status codesEvery code and when you actually see itDates & timesISO 8601, epoch, Excel serials, DSTHTTP headersContent-Type, Disposition, Range, CORSRegex cheat sheetSyntax, flags and ready-made patternsGenerate files (CLI)Make test files on any OSCrypto & certificatesSSL/PEM, hashing, encryptionWeb app testingWhat to test, with a file for each caseDesktop app testingPaths, names, encodings and savingMobile app testingPickers, photos, flaky networksCLI testingArguments, pipes and exit codesLarge file upload testingDefault limits, 413s and exact sizes1 GB test file1 GB and 2 GB, with SHA-25610 GB test fileMake one locally in secondsDownload speed test files10 MB to 2 GB of random data