Why Domains Starting or Ending with a Hyphen Are Technically Invalid (Yet Still Confuse Users) Published: 29 Jul, 2025

One of the lesser-known edge cases in domain syntax involves domain names that start or end with a hyphen. While this might seem like a valid naming convention—especially in the context of subdirectories or slugs—it’s actually strictly forbidden by the domain name system (DNS) specifications.
According to RFC 1035, domain labels (the parts between the dots) must follow specific syntactical rules:
-
Labels may contain only letters, digits, and hyphens.
-
Labels must not begin or end with a hyphen.
-
Labels must be between 1 and 63 characters long.
This means that a domain like -example.com
or example-.com
is not just unusual—it’s non-resolvable at the DNS level. Such domains will fail to register with any ICANN-accredited registrar.
But Why Is This Still a Problem?
Despite being invalid, users and developers often:
-
Attempt to register domains with leading or trailing hyphens, especially via automated domain suggestion tools or scripts.
-
Misconfigure DNS records by inserting such names in custom BIND zones, causing name resolution failures.
-
Confuse hyphen constraints in domain names with their permissibility in URLs (e.g.
/category-name/
is valid, but-domain.com
is not).
What Happens if You Try to Register One?
Registrars will typically return a 400 Bad Request
or a validation error. However, some older or poorly implemented registration interfaces might let the input through to a secondary layer—causing confusing errors or silent rejections later in the flow.
Some WHOIS tools may also return misleading results if a user queries -example.com
, interpreting it as example.com
.
Conclusion
If your script or system is generating domain suggestions, validate explicitly against leading/trailing hyphens using a proper regex. The confusion stems from the similarity to URL slug formatting, but at the DNS level, this is a fatal error.