✅ Hostname / Domain Syntax Validator
Check a hostname or domain against RFC 1035 label rules: each label 1-63 characters, letters/ digits/hyphens only, no leading or trailing hyphen, and a total length of 253 characters or less.
The rules being applied
The name is split on dots and each label is tested against one pattern, in your browser. No query is made, so a name can be perfectly valid here and still not exist anywhere in DNS.
^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$
That is: 1 to 63 characters per label, letters, digits and hyphens only, and a
hyphen may never be the first or last character. Two extra checks run over the
whole string - 253 characters maximum, and no empty label from a doubled dot.
my-site.example.com passes; -site.example.com fails on
the leading hyphen, and site..com fails on the empty label. A
trailing dot is allowed and is not counted as a label.
Two things the pattern rejects on purpose
- Underscores.
_dmarc.example.comis reported invalid, and that is correct for a hostname - but underscore labels are deliberately legal for service records such as_dmarc,_domainkeyand_sip._tcp. Read a failure there as "not a hostname", not "will not work". - Accented and non-Latin characters. Convert them to Punycode
first;
münchen.deis stored in DNS asxn--mnchen-3ya.de, and that form passes.
Frequently asked questions
Can a domain name contain an underscore?
Not as a hostname. Underscores are barred from the RFC 1035 hostname character
set, so browsers and TLS certificates reject them. DNS itself stores them fine,
which is why _dmarc and _domainkey records work.
What is the maximum length of a domain name?
253 characters in the text form, and 63 for any single label between the dots. The 253 figure comes from the 255-byte wire limit once the length bytes are counted.
Can a hostname start with a number?
Yes. The original 1985 rule required a letter, but RFC 1123 lifted it in 1989,
so 1drv.ms and 4chan.org are valid. Only hyphens are
barred from the first position.