
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.
Manage hosts files without the terminal
ToggleHosts helps you manage environments visually on Windows, macOS, and Linux, with automatic DNS flush and backups.
One-time payment
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. ToggleHosts 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
Frequently Asked Questions
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.
.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.
No. .local is reserved for mDNS/Bonjour and can cause slow or failed resolution and conflicts on many systems.
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
How to Flush DNS Cache on Windows, macOS & Linux (2026)Flushing DNS & cache
How to Flush DNS Cache on Windows, macOS & Linux (2026)
8 min read
How to Use Subdomains on localhost for Local Development (2026)Local development
How to Use Subdomains on localhost for Local Development (2026)
4 min read
Flush DNS on Windows 10 & 11: ipconfig /flushdns (2026)Flushing DNS & cache
Flush DNS on Windows 10 & 11: ipconfig /flushdns (2026)
3 min read