Which TLD to Use for Local Development (.test vs .localhost)
Which TLD to use for local development: prefer .test, avoid .dev and .local. Why .test is reserved, how to map it in the hosts file, and HTTPS tips.
Sleezr Team

Table of Contents
Use `.test` for local development. It is officially reserved by the IETF (RFC 6761) for testing, so it will never become a real public domain and cannot collide with a live site. Avoid .dev (a real Google-owned TLD that forces HTTPS) and .local (reserved for mDNS/Bonjour). The other safe reserved options are .localhost and .example.
Best TLDs for local development
| TLD | Status | Use for local dev? |
|---|---|---|
| .test | Reserved (RFC 6761) | Yes, recommended |
| .localhost | Reserved (RFC 6761) | Yes |
| .example | Reserved (RFC 6761) | Yes (less common) |
| .dev | Real TLD, HSTS-preloaded | No, forces HTTPS |
| .local | mDNS/Bonjour | No, resolution conflicts |
| .app | Real TLD, HSTS-preloaded | No |
Why .test wins
.test is guaranteed never to resolve on the public internet, so myapp.test always means "my local project." There is no risk that a colleague's typo leaks to a real site, and no browser HTTPS coercion.
Why avoid .dev and .app
Both are real TLDs on the HSTS preload list. Browsers force HTTPS on them, so a plain HTTP dev server at myapp.dev fails to load. If you need HTTPS locally, set it up deliberately with mkcert, see local HTTPS with mkcert.
Why avoid .local
.local is reserved for multicast DNS (Bonjour/Avahi). Using it for hosts entries causes slow lookups, intermittent failures, and conflicts with device discovery.
How to set up a .test domain
Add it to the hosts file and flush DNS:
127.0.0.1 myapp.test api.myapp.testSee the hosts file syntax guide and, when done, flush DNS. For many dynamic subdomains (*.myapp.test), the hosts file cannot use wildcards, use dnsmasq, covered in wildcard local domains with dnsmasq.
Manage them without editing files by hand
Juggling several .test domains across projects gets messy fast. Sleezr stores each mapping with a one-click toggle and flushes DNS automatically, so switching between projects is instant.
_Last reviewed: June 2026._
Sources and further reading
- How DNS works (Cloudflare Learning)
- The hosts file explained (Wikipedia)
- hosts(5) manual page (man7.org)
Frequently Asked Questions
What TLD should I use for local development?
Use .test. It is reserved by the IETF (RFC 6761) for testing and will never be a real public TLD, so it cannot clash with a live domain.
Why should I avoid .dev for local development?
.dev is a real public TLD owned by Google and is on the HSTS preload list, forcing HTTPS in browsers. That breaks plain HTTP local sites.
Is .local safe for local development?
No. .local is reserved for mDNS/Bonjour and can cause slow or failed resolution and conflicts on many systems.
How do I map a .test domain?
Add a line to the hosts file: 127.0.0.1 myapp.test, then flush DNS. For many subdomains, use dnsmasq with a wildcard.
Related Articles
WordPress Local Development With a .test Domain (hosts file)
Set up a local WordPress site with a clean .test domain using the hosts file. Works with LocalWP, MAMP, XAMPP and Docker. Map the domain, flush DNS, configure WP.
Sleezr Team
Developer tools team
macOS 26 Tahoe: Flush DNS Cache Command (2026)
Flush DNS cache on macOS 26 Tahoe with the exact Terminal command, verification steps, browser cache checks, and hosts file troubleshooting.
Sleezr Team
Developer tools team
Hosts File: Location, Syntax and Uses (2026)
Learn what the hosts file does, where to find it on Mac, Windows and Linux, syntax examples, local dev uses and mistakes to avoid.
Sleezr Team
Can You Edit the Hosts File Without Admin Rights?
Can you edit the hosts file without administrator rights? The honest answer plus real alternatives on Windows, Mac and Linux when you cannot elevate (proxy, Docker, local DNS, SSH).
Sleezr Team
Developer tools team
How to Use Subdomains on localhost for Local Development
Use subdomains on localhost: the free *.localhost trick browsers resolve automatically, fixed subdomains via the hosts file, and wildcard subdomains with dnsmasq on Mac and Linux.
Sleezr Team
Developer tools team