Guides Blogs 6 min read 1,171 words

Can Domain Names Have Special Characters? What Is Allowed

Ordinary website hostnames do not allow spaces, underscores or most symbols. Learn how IDNs and DNS service-record names differ, with naming alternatives.

Can domain names have special characters? Mostly no

For an ordinary ASCII website hostname, each label uses letters a to z, digits 0 to 9 and the hyphen, with placement and length restrictions. Spaces, underscores, punctuation, currency signs and emoji are not allowed in a normal name. The one real exception is internationalized domain names, which let a name use accented letters and non-Latin scripts; those are converted into an ASCII form before they reach DNS.

That short answer covers the questions people actually arrive with — spaces, underscores and symbols — so this guide handles all three in one place, and explains what to use instead.

What counts as a special character

Anything outside the letters, digits and hyphen is a special character for domain purposes. RFC 3696 calls the permitted set the "LDH rule" and states plainly that no other symbols or punctuation characters are permitted, nor is blank space.

  • a–z, 0–9: Allowed — The basic set.
  • - (hyphen): Allowed — Not at the start or end of a label.
  • (space): Not allowed — Not part of an ordinary website hostname.
  • _ (underscore): Not allowed — Appears in DNS record names, not hostnames.
  • @ # $ % & + / ? ! ~: Not allowed — Reserved for other parts of a URL.
  • . (dot): Separator — Separates hostname labels.
Illustration of a globe surrounded by flags, representing languages and international domains.

Why the rule is so strict

A domain name exists to be typed, copied and matched exactly. Every character the system allows has to survive a browser address bar, an email client, a TLS certificate and a DNS server without being reinterpreted. Spaces are the clearest example: inside a URL a space has to be written as %20, so a name containing one could never be a single unambiguous string. ICANN describes the constraint as a "hostname rule": ordinary ASCII hostnames use letters, digits and the hyphen; DNS record names themselves can support a wider range of values.

The exception: internationalized domain names

Internationalized domain names, or IDNs, allow characters from other scripts — Arabic, Chinese, Cyrillic, Devanagari — as well as Latin letters with accents. The name a user types is called a U-label; it is converted with Punycode into an ASCII A-label that begins with xn--, and DNS queries use the encoded A-label form for those internationalized labels. Each registry decides which scripts and characters it accepts, so the same string can be registrable in one extension and refused in another.

Even inside IDNs the character set is filtered. RFC 5891 requires each label to be checked against the IDNA tables and rejects characters that are disallowed or unassigned, so emoji, currency signs and most punctuation are not valid IDNA label characters. This is a statement about IDNA-compatible website hostnames, not every possible DNS record name.

Spaces in domain names

There is no way to register a domain with a space. A space is not in the LDH set, and the %20 form is percent-encoding for a URL path, not part of a name. The substitute is the hyphen: my-shop.com reads as two words where myshop.com runs together. A hyphen has placement rules of its own, covered in dashes in domain names.

For longer groupings, a subdomain does the job a space cannot: shop.example.com separates two ideas while each label stays legal. Our guide to subdomains explains how that structure works.

Underscores in domain names

An underscore is not part of the hostname character set either, so it cannot appear in a name you register. It does appear in DNS, and that is where the confusion starts: records such as _dmarc.example.com, or the _acme-challenge record used for certificate validation, really do contain an underscore in their name field. Those are service-specific DNS record names, used by mail and certificate systems, not registrable hostnames that a browser should open.

So the rule of thumb is simple. If you need a separator in a domain name, use a hyphen. If you are typing an underscore, you are probably editing a DNS record rather than choosing a name.

What to use instead

  • A hyphen where words must be visually separated in the name.
  • A subdomain when the extra word describes a section rather than the brand.
  • Spelled-out words rather than symbols: "and" instead of "&", "at" instead of "@".
  • An IDN only if your audience can type it. An accented name is a real option, but confirm the extension offers it and that people can enter the characters.
  • A quick availability check. Check available registration data with our WHOIS lookup and confirm registrability and availability with the registrar before building a brand around it, and keep numbers in domain names in mind if the name includes digits.

Do the same rules apply to subdomains?

Yes. Each label of a website hostname follows the same hostname and IDNA rules. DNS record owners used for services are a separate case and can contain characters such as underscores. One consequence is easy to miss: a string that works as a search query or a file name often fails as a label, because those contexts accept characters that ordinary website hostnames do not. If a name only survives with a space or an ampersand in it, it is not a name you can register.

It also means you can test a candidate quickly. Write it the way it would appear in a browser, with no spaces and no symbols, and see whether it still reads the way you meant. If the meaning depends on the missing character, the wording needs another look.

Frequently asked questions

Can a domain name have an @ sign?

No. The @ separates the user from the domain in an email address; it cannot be part of the domain itself.

Can a domain name have a space if I encode it?

No. Percent-encoding turns a space into %20 inside a URL, but the registered name still cannot contain the character.

Are accented characters allowed?

Yes, in extensions whose registry offers IDN registration. The accented form is stored as an xn-- A-label, and not every script or character is permitted within it.

What about a dot inside a name?

The dot is the label separator, so it always creates another level. shop.example.com is a subdomain, not one label containing a dot.

Can I use an underscore in a DNS record?

Yes, and that is the one place underscores are normal, in the host field of records such as DMARC or ACME validation. It does not make the underscore valid in a registered domain name.

Why do some sites have unusual characters in their address?

Those are IDNs. The characters you see are the U-label; behind them the DNS holds a Punycode A-label starting with xn--, which is what the name resolves through.

Sources

For the distinction between DNS labels and application hostname rules, see RFC 2181, Section 11. DNS can carry labels that applications refuse as website hostnames.