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.
Locahl 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. Locahl stores each mapping with a one-click toggle and flushes DNS automatically, so switching between projects is instant.
_Last reviewed: June 2026._
Ready to simplify your workflow?
Stop wasting time with the terminal. Locahl lets you manage your hosts file in a few clicks, with automatic validation and no risk of errors.
- Intuitive visual interface
- Automatic DNS flush
- Multi-environment management
- Automatic backups
- JSON Import/Export
Reader Reviews
"Switched all my projects from .dev to .test after reading this. No more forced-HTTPS surprises."
June 12, 2026
"Clear reasoning on why .local breaks with mDNS. Exactly the explanation I needed."
June 10, 2026
"Great guidance. A wildcard subdomain example would be the cherry on top."
June 8, 2026
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.
Locahl Team
Developer tools team
macOS Tahoe Flush DNS Cache Command
Clear DNS cache on macOS Tahoe 26 with the exact Terminal command, verification steps, browser cache checks and hosts file troubleshooting.
Locahl 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.
Locahl Team
Flush DNS on Windows 10 & 11: ipconfig /flushdns (2026)
Flush the DNS cache on Windows 10 and 11 with ipconfig /flushdns. Step-by-step command, verification, and fixes when changes still do not apply.
Locahl Team
Developer tools team
Flush DNS on Linux: systemd-resolved & more (2026)
Flush the DNS cache on Linux with resolvectl flush-caches (systemd-resolved), plus nscd, dnsmasq and BIND. Commands by setup, with verification steps.
Locahl Team
Developer tools team