tldlist.us/Reserved TLDs for testing

.test

Reserved TLDs for testing and documentation

RFC 2606 and special-use domain reference · Updated

Use these names

Use .test for controlled testing, .example or example.com for documentation, .invalid when a name must visibly fail, and .localhost for loopback use. These four TLDs were reserved specifically to prevent test code and examples from colliding with real public domains.

Why invented test endings are dangerous

A made-up suffix is not necessarily unused forever. A team might configure service.internal, shop.dev or demo.app on a private resolver and assume it can never exist publicly. If the same ending is delegated in the global DNS—or already is—queries can leak outside the test network, certificates can be requested for the wrong namespace and users can reach someone else's site.

RFC 2606 solves that collision problem by permanently reserving four names for explicit purposes. The later special-use framework in RFC 6761 records how applications and resolvers should handle several of them. IANA's live Special-Use Domain Names registry is the current machine-oriented reference.

The four reserved top-level names

NameIntended useGood exampleDo not assume
.testTesting DNS-related code and configurationsapi.project.testPublic DNS or trusted TLS will be provided automatically
.exampleDocumentation and illustrative namesstore.exampleA production web service will exist
.invalidA name intended to be clearly invalidmissing.invalidEvery tool will fail in exactly the same way
.localhostLoopback host namingapp.localhostAll subdomain and certificate behavior is identical across stacks

How to choose the right reserved name

Use .test for an environment you control

.test is the best semantic match for integration labs, local DNS zones, examples that demonstrate resolver configuration and non-public application environments. Reservation prevents future public delegation, but it does not create records. Your hosts file, container resolver, local DNS server or testing framework still has to map the name.

Use example domains in anything another person may copy

Documentation should normally use example.com, example.net, example.org or a label under .example. IANA maintains the three second-level names for exactly this purpose and states that they are not available for registration or transfer. Readers can safely recognize them as placeholders, and pasted sample code does not send traffic to an unrelated registrant.

Use .invalid to demonstrate failure

.invalid is for a string that should be unmistakably non-working: form-validation examples, negative tests and documentation explaining error paths. It expresses intent better than a random misspelling of a real TLD. A test should still assert the application's expected outcome, because browsers, resolvers and libraries may surface failure with different error messages.

Use localhost for loopback, not a shared staging service

localhost is special because name-resolution libraries are expected to map it to loopback. It is appropriate for a process on the same machine. A service that teammates, CI runners or mobile devices must reach is not “local” to all of them; give that environment controlled DNS under a reserved test zone or a subdomain you own.

Related names people often confuse

NameStatusUse
.localSpecial-use, not one of RFC 2606's fourMulticast DNS; avoid using it as an ordinary private DNS suffix
home.arpaSpecial-use nameLocally served naming in residential home networks
.onionSpecial-use nameTor onion services, not the public DNS root
.internalDo not infer safety from the wordCheck current standards and local architecture before adopting
.devReal delegated gTLDPublic developer sites; HTTPS is required by HSTS preload
.appReal delegated gTLDPublic applications; also HSTS-preloaded

When an owned domain is better

Reserved names are excellent for isolated tests, but a realistic public staging environment may need trusted certificates, third-party OAuth callbacks, email validation, public webhooks or access from devices outside the private resolver. In that case, use a subdomain of a domain the organization controls—such as staging.example-owned-domain.com—and protect it with authentication and access controls.

Ownership gives the team real DNS and certificate control. The trade-off is operational: test endpoints can be discovered, indexed or attacked unless robots directives, authentication and network policy are configured correctly. Never rely on an obscure hostname as the only security boundary.

Rule of thumb. Use reserved names when the system should stay local or illustrative. Use an owned subdomain when outside services must resolve and trust it.

Frequently asked questions

Which TLD should I use for a test domain?
Use .test for controlled DNS and application tests. It is permanently reserved, so it cannot later become a conflicting public TLD.
Which domain should documentation use?
Use example.com, example.net, example.org or a name under .example. These are reserved for examples and cannot be registered by a third party.
Do all .localhost subdomains work identically?
No. Localhost is special-use and commonly maps to loopback, but arbitrary subdomain, cookie and certificate behavior can vary by application. Test the actual stack.
Should I use .dev locally?
No. .dev is a real, HSTS-preloaded public TLD. Browsers require HTTPS, and a name you invent could belong to someone else. Use .test, localhost or a subdomain you own.