While looking into how to set up some static DNS-SD services in our network, I came across http://www.dns-sd.org/ServerStaticSetup.html, which states that Active Directory's DNS server does not support DNS names with spaces in them.

Does anyone know if this is still true (as the page feels rather old)?

Update: I'm primarily referring to PTR and SRV records, not A/CNAME records.

  • 2
    This may sound crazy, but I've never, EVER seen a URI with a space in it, is that even RFC compliant? Why is this relevant to you? Dec 19, 2011 at 10:01
  • 11
    RFC1035, 2.3.1: "[Domains] must start with a letter, end with a letter or digit, and have as interior characters only letters, digits, and hyphen."
    – user80776
    Dec 19, 2011 at 10:05
  • @SpacemanSpiff it's not RFC compliant in any URL scheme where the domain portion represents a hostname (i.e. most of them).
    – Alnitak
    Dec 19, 2011 at 10:31
  • Can you give an example of the specific sort of entry you'd like to create?
    – Alnitak
    Dec 19, 2011 at 11:46
  • 1
    @Sam that quoted phrase is about host names, not "domains".
    – Alnitak
    Dec 19, 2011 at 17:14

4 Answers 4


A domain name can include any binary octet in the range 0 to 255.

However if your AD entries represent host names, then a space is not a valid character. A host name (i.e. a domain name that points to an A or AAAA record) must follow the rules from RFC 1123, which essentially restricts the legal characters to LDH ("letter digit hyphen").

Hence for other entries it's perfectly possible that MS have misinterpreted the RFCs. They won't be the first, and they certainly won't be the last.


§5.1 of RFC 1035:

Quoting conventions allow arbitrary characters to be stored in domain names.

and § of RFC 1123:

The DNS defines domain name syntax very generally -- a string of labels each containing up to 63 8-bit octets, separated by dots

and §11 of RFC 2181:

any binary string whatever can be used as the label of any resource record

  • Yes, that's what I'm afraid of...
    – gmw
    Dec 19, 2011 at 11:47

Ah - sorry to be snippy, but you have a wag the dog here. It is not that AD does not support DNS names with spaces, but that DNS names per definition and RFC are not allowed to have spaces to start with. RFC 952 and 1123 both do not allow spaces as part of a DNS name.

So, AD does not lack support for spaces in DNS names as a shortcoing but because it follows the same rules as everyone else.

  • 2
    Please fix your nomenclature. Strictly speaking a DNS entry may contain spaces. However a hostname may not.
    – Alnitak
    Dec 19, 2011 at 10:23
  • 3
    I'm afraid you're wrong - in DNS there are clear instances of domain names (not "ZONE names") which are not required to follow the RFC 1123 rules for a "host name". For example, the underscore prefixed names used by SRV records. See also § of RFC 1123, and my profile.
    – Alnitak
    Dec 19, 2011 at 10:38
  • 6
    srv records are very special cases. Again, you play games. Where does it allow a space? Quote the section of a RFC allowing a space somewhere, and you are right. Go on arguing and you still are wrong. Stop whining someone calls your bluff.
    – TomTom
    Dec 19, 2011 at 10:42
  • 18
    I did already - § of RFC 1123 "The DNS defines domain name syntax very generally -- a string of labels each containing up to 63 8-bit octets, separated by dots". DNS standards and the protocol are my day job, FWIW.
    – Alnitak
    Dec 19, 2011 at 10:50
  • 1
    @TomTom my answer cites the relevant portion of the RFCs that show that Alnitak is correct; hostnames MAY NOT contain spaces, however DNS names in general MAY indeed contain spaces.
    – aculich
    Dec 23, 2011 at 11:42

The answer to your specific question is NO, Active Directory does NOT allow spaces in DNS hostnames. The prohibited characters are clearly outlined in KB 909264 - Naming conventions in Active Directory for computers, domains, sites, and OUs in the section labeled Disallowed characters it reads:

The DNS host name cannot contain blank or space characters.

To extend the answer beyond Active Directory to the DNS domain name system in general the situation is a little trickier because while spaces technically are allowed in certain instances, in practice you will probably never encounter such a case yourself.


The long answer according to §2 of RFC 3696, Restrictions on domain (DNS) names, is that:

Any characters, or combination of bits (as octets), are permitted in DNS names.

It continues stating (emphasis mine):

However, there is a preferred form that is required by most applications. This preferred form has been the only one permitted in the names of top-level domains, or TLDs. In general, it is also the only form permitted in most second-level names registered in TLDs, although some names that are normally not seen by users obey other rules. It derives from the original ARPANET rules for the naming of hosts (i.e., the "hostname" rule) and is perhaps better described as the "LDH rule", after the characters that it permits. The LDH rule, as updated, provides that the labels (words or strings separated by periods) that make up a domain name must consist of only the ASCII [ASCII] alphabetic and numeric characters, plus the hyphen. No other symbols or punctuation characters are permitted, nor is blank space. If the hyphen is used, it is not permitted to appear at either the beginning or end of a label. There is an additional rule that essentially requires that top-level domain names not be all-numeric.

In practice this means you should NOT use spaces, even though in the most general specification of domain names as defined in these excerpts from §5.1 of RFC 1035 it is possible to allow spaces in domain names:

<domain-name>s make up a large share of the data in the master file. The labels in the domain name are expressed as character strings and separated by dots. Quoting conventions allow arbitrary characters to be stored in domain names.


<character-string> is expressed in one or two ways: as a contiguous set of characters without interior spaces, or as a string beginning with a " and ending with a ". Inside a " delimited string any character can occur, except for a " itself, which must be quoted using \ (back slash).

Keep in mind that elsewhere in RFC 1035, specifically §2.3, it warns:

2.3. Conventions

The domain system has several conventions dealing with low-level, but fundamental, issues. While the implementor is free to violate these conventions WITHIN HIS OWN SYSTEM, he must observe these conventions in ALL behavior observed from other hosts.

2.3.1. Preferred name syntax

The DNS specifications attempt to be as general as possible in the rules for constructing domain names. The idea is that the name of any existing object can be expressed as a domain name with minimal changes.

However, when assigning a domain name for an object, the prudent user will select a name which satisfies both the rules of the domain system and any existing rules for the object, whether these rules are published or implied by existing programs.

For example, when naming a mail domain, the user should satisfy both the rules of this memo and those in RFC-822. When creating a new host name, the old rules for HOSTS.TXT should be followed. This avoids problems when old software is converted to use domain names.

I would certainly welcome further clarification or correction of my interpretation, but please do not do so unless you're able to cite specific sections of RFCs to either affirm or deny this interpretation.

  • so will you remove your downvote now? ;)
    – Alnitak
    Dec 23, 2011 at 11:51
  • +1 for the additional reference (RFC 3696)
    – Alnitak
    Dec 23, 2011 at 11:52
  • @Alnitak, yes I initially mis-read your post... have now removed the downvote and my comment (so it does not add to yet more confusion). The way the RFCs are written it's surprising this whole internet thingy works at all! :)
    – aculich
    Dec 23, 2011 at 11:58
  • I did add the "binary" qualification after you commented to make it clear I wan't talking about IP address octets. The DNS RFCs can be particularly hard to understand because back then they didn't get such rigorous review as they do now, and inconsistencies are quite common.
    – Alnitak
    Dec 23, 2011 at 12:01
  • Yes, I see that now that you did say "binary".
    – aculich
    Dec 23, 2011 at 12:02

By default Windows DNS servers do not support spaces in DNS names, however by changing the setting ‘Server Properties -> Advanced tab -> Name checking’ to ‘All Names’ the server will happily accept and serve up entries with spaces.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .