Chapter 01 · Part I · The namespace

The namespace & delegation

You already know the picture: DNS is a phone book shaped like a tree, read from the right. This chapter goes underneath that picture. What a name actually is, byte by byte; which names are legal and to whom; how a name in Greek or Japanese squeezes through a system built for ASCII; where one operator's authority ends and the next begins; and who, in the end, is allowed to write each line of the tree.

63 bytesthe longest a single label can be: its length must fit in the six low bits of one byte (RFC 1035 §2.3.4)
255 bytesthe longest a whole name can be on the wire, counting every length byte and the final zero for the root (RFC 1035)
xn--the four characters that mark an A-label: an internationalized label encoded into plain ASCII with Punycode (RFC 5890)

Common mix-up: a domain and a zone are not the same thing. The domain example.com is the whole branch of the tree: example.com and every name beneath it, however deep. A zone is the part of that branch that one set of servers is responsible for. If shop.example.com has been handed to someone else, it is still inside the domain example.com, but it is no longer in the zone example.com. Most DNS confusion about "who controls this name" comes from mixing the two up.

What a name is made of

Labels, and the dot at the end

A DNS name is a list of labels. In www.example.com the labels are www, example and com. Each label names one node of the tree, and the list is written from the leaf up to the top: the most specific label on the left, the most general on the right. The dots are only how people write the list down; they are separators, not part of any label.

There is one more label in every name, and you rarely see it. The top of the tree, the root, has a name too: the empty label, a label with nothing in it. Written out in full, the name is www.example.com., with a dot at the end, and the empty space after that dot is the root. A name written all the way to the root is a fully qualified domain name, or FQDN. It says exactly where the node sits, with nothing left for software to guess.

Most of the time you leave that last dot off and nothing goes wrong, because browsers and resolvers assume you meant the full name. But inside a zone file, and in some tools, the dot is load-bearing. Write mail.example.com without it in a zone file for example.com and the server appends the zone's own name, giving you mail.example.com.example.com. instead. That one missing dot is behind a surprising share of broken mail setups. On your own computer, a name with no dot at the end can also be expanded by a search list, which Chapter 10 covers.

Names are matched without regard to case. WWW.Example.COM and www.example.com are the same name, and a server must treat them as the same (RFC 4343). But the rule is narrow: it applies to the ASCII letters A to Z only, and a server is supposed to preserve the case you sent when it echoes the name back. Bytes outside ASCII are compared exactly as they are, which is one reason internationalized names are not sent as raw Unicode, as you will see below.

; the same node, three ways of writing it
www.example.com.     ; fully qualified: ends at the root
www.example.com      ; relative: software decides what comes after
WWW.Example.COM.     ; same name: ASCII case is ignored when matching (RFC 4343)
; on the wire, as length-prefixed labels (hex):
03 77 77 77 07 65 78 61 6d 70 6c 65 03 63 6f 6d 00
;  3  w  w  w   7  e  x  a  m  p  l  e   3  c  o  m   0 = the root

That last line is how the name actually travels. There are no dots in a DNS message. Each label is sent as one byte giving its length, followed by that many bytes of label, and the name ends with a zero-length label: a single zero byte, the root. This is where the two famous limits come from. A label's length has to fit in that one length byte, and the top two bits of it are reserved (they mark the compression pointers of Chapter 2), which leaves six bits: at most 63. And a whole name, length bytes and final zero included, may be at most 255 bytes. Because of the length bytes, the longest name you can type is shorter: 253 characters, without the trailing dot.

wire length = Σ (1 + length of each label) + 1 ≤ 255
One length byte per label, the label's own bytes, and one zero byte for the root. www.example.com is (1+3) + (1+7) + (1+3) + 1 = 17 bytes. Each label separately must be 63 bytes or fewer.
Go deeper: can a label contain a dot?

On the wire, yes. Because each label carries its own length, the bytes inside it can be anything, including the byte for a full stop. In text, zone files and tools such as dig write such a dot as \. so it is not read as a separator, and arbitrary bytes as \DDD in decimal. RFC 1035 §5.1 defines those escapes.

Nobody sensible puts a dot inside a label for a host, but the escape does appear in practice: the email address of a zone's administrator is stored in its SOA record as a name, with the @ turned into the first dot. An address like first.last@example.com has to be written first\.last.example.com. to survive. Chapter 6 has the SOA in full.

Instrument 1

The name dissector

Type any name, in any script. The dissector splits it into labels, converts every non-ASCII label to its A-label with a real RFC 3492 Punycode encoder written into this page, builds the exact bytes a DNS message would carry, and checks them against the 63-byte and 255-byte limits and against the host-name rule. Problems are written out in words, not just shown in color. Nothing is sent anywhere: all of this happens in your browser.

Labels (plus root)–
Wire length–
Longest label–
Valid as a host name?–
#As typedSent asBytesVerdict
The bytes on the wire (hex, length bytes highlighted)

Two rule books

What DNS allows, and what a host name allows

There are two different sets of rules for what can go in a label, and they are often confused. The DNS itself is permissive. RFC 2181 §11 says it plainly: the length limits are the only restriction the DNS places on a label, and any byte value at all may appear. The protocol is a database of byte strings, and it does not care what the bytes mean.

Host names are stricter, because they were written into older software long before DNS existed. The rule usually called LDH, letters, digits and hyphen, comes from the host tables of the early ARPANET (RFC 952) and was relaxed slightly by RFC 1123 §2.1: a label may contain the ASCII letters a to z (either case), the digits 0 to 9 and the hyphen, may start with a digit, but may not start or end with a hyphen. A name that will be typed into a browser, used for a mail server or put in a certificate is expected to follow it.

So a label like my_server is perfectly legal DNS and an illegal host name. That gap is exactly what the underscore labels exploit. Because no host can ever be called _dmarc or _tcp, those labels can be used to hang records on a name for a purpose, without any chance of colliding with a real machine. SRV records live at names like _sip._tcp.example.com (RFC 2782), DMARC policy at _dmarc.example.com, and DKIM keys under _domainkey. Chapter 5 and Chapter 8 use them.

LabelLegal in DNS?Legal host name?Why
wwwYesYesLetters only
3comYesYesRFC 1123 allows a leading digit; RFC 952 did not
-edgeYesNoA host label may not start or end with a hyphen
_dmarcYesNo, on purposeUnderscore labels mark records that belong to a service, not a host
my_serverYesNoUnderscore is not a letter, digit or hyphen
ab--cdYesReservedHyphens in the 3rd and 4th place are kept for encodings like xn-- (RFC 5891)
xn--bcher-kvaYesYesAn A-label: pure LDH, standing in for bücher
bücherAs raw bytes, yesNoSent as its A-label instead; see the next section
Every script, one alphabet on the wire

Internationalized names and Punycode

Most of the world does not write in ASCII, and people reasonably want names in their own scripts. The DNS could carry the UTF-8 bytes of bücher without complaint, but almost nothing else could: host-name checks in software would reject it, case-insensitive matching only knows A to Z, and a single Unicode letter can be written as more than one byte sequence. The solution standardized as IDNA leaves the DNS alone and changes the names instead. Every non-ASCII label is converted, in the application, into an ASCII label that obeys the host-name rule, and that is what goes into zone files and DNS messages.

The two forms have names. The Unicode form that people read is the U-label: bücher. The ASCII form that the DNS carries is the A-label: xn--bcher-kva. The prefix xn-- is the ACE prefix, short for ASCII-compatible encoding, and it tells software that what follows is encoded (RFC 5890). The encoding itself is Punycode, defined in RFC 3492. Your browser's address bar shows you the U-label; the DNS only ever sees the A-label.

Punycode is short because it is clever. It copies all the plain ASCII letters first, in order, then a hyphen, then a compact series of instructions that say which Unicode characters to insert and where. Here is the whole thing for bücher, German for "books":

  1. Copy the basic letters: bcher. Five characters, then a separator hyphen.
  2. One character is left, ü, which is code point U+00FC, decimal 252. The encoder walks upward from 128, the first non-ASCII code point. To reach 252 it must step over 252 − 128 = 124 values, and at each value it considers all 6 possible insertion places in a 5-letter string, so 124 × 6 = 744. Then ü goes in at position 1, after the b: one more step. The single number to encode is 745.
  3. 745 is written as a variable-length number in base 36 using the letters a to z and digits 0 to 9, with thresholds that adapt as the encoder goes. With the starting settings it comes out as three digits: k, v, a.
  4. Add the prefix: xn--bcher-kva. Thirteen ASCII characters, every one of them legal in a host name.

The dissector above shows the same trace for whatever you type. Try 日本語.example, where there are no basic letters at all, so there is no hyphen and the A-label is xn--wgv71a119e.

One warning belongs here, and its defenses belong in Chapter 13. Many scripts contain letters that look exactly like Latin ones: the Cyrillic а is not the Latin a, but on screen they are identical. A name built from look-alikes is a homograph, and it can be used to imitate a familiar brand. Browsers defend against this by showing the raw xn-- form when a label mixes scripts in a suspicious way, and registries restrict which characters they will accept. It is a reason to be glad the A-label exists: it never lies about which characters are really there.

Go deeper: IDNA2008, UTS #46 and the letter ß

The current standard is IDNA2008 (RFCs 5890 to 5894). It decides which code points may appear in a label by their Unicode properties (RFC 5892), and it deliberately does not fold case or map look-alike forms: an application is expected to do any mapping before it converts. Browsers do that mapping using Unicode Technical Standard #46, which lowercases, normalizes to NFC and handles a few awkward compatibility cases.

The awkward cases are real. Under the older IDNA2003, the German sharp s, ß, was mapped to "ss", so straße and strasse were the same name. IDNA2008 made ß a letter in its own right, with its own A-label. Software that follows different rules can therefore reach different names from the same typed text. The dissector does a simple version of the mapping (NFC, then lowercase) and then cross-checks its answer against your browser's own converter, which follows UTS #46.

Domains, zones and cuts

Where one operator's authority ends

If one organization had to answer for the entire tree, DNS would never have scaled. The trick is delegation: any node can hand everything beneath it to someone else. The point where that happens is a zone cut, and the pieces between cuts are zones. A zone starts at a node called its apex, includes the nodes below it, and stops at every cut where a child has been delegated away (RFC 1034 §4.2, RFC 9499).

That is why a domain and a zone differ. The domain example.com is the whole subtree. The zone example.com is the part of that subtree that the example.com servers answer for. Delegate shop.example.com to a different team and the domain does not change at all, but the zone shrinks.

A cut is made of NS records, and it is visible from both sides. In the parent zone, the cut is a set of NS records at the child's name, saying which servers to ask. Those records are a signpost. The parent is not authoritative for them: it is passing on what the child told it, and a parent's server marks its answer as a referral, not as an authoritative answer. In the child zone, the same NS records appear at the apex, together with an SOA record, and here they are the real, authoritative data. When the two copies disagree, the child's is the truth, and the mismatch is a classic source of hard-to-find failures.

What "authoritative" means is simply this: a server is authoritative for a name when it holds the zone that contains it, from the zone's own source of truth, rather than from a cache or a signpost. Only an authoritative server sets the AA (authoritative answer) bit in a reply.

domain example.com: the whole branch zone example.com zone shop.example.com example.com www mail shop eu us zone cut ↗ parent holds: shop NS (a signpost, not authoritative) child holds: SOA + NS at its apex (authoritative)
One domain, two zones. The dashed edge is the cut: the parent keeps NS records for shop as a signpost, and the shop.example.com zone holds the authoritative copy.
; SIMULATED. Ask the example.com servers about a name below the cut:
;; no aa flag: this is a referral, not an answer
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 2, ADDITIONAL: 2
;; AUTHORITY SECTION:
shop.example.com.      86400  IN  NS   ns1.shop.example.com.
shop.example.com.      86400  IN  NS   ns2.shop.example.com.
;; ADDITIONAL SECTION:   (glue: the servers live inside the zone they serve)
ns1.shop.example.com.  86400  IN  A    192.0.2.53
ns2.shop.example.com.  86400  IN  A    198.51.100.53

; SIMULATED. Ask ns1.shop.example.com the same question:
;; flags: qr aa rd; QUERY: 1, ANSWER: 1   (aa: authoritative)
eu.shop.example.com.    3600  IN  A    203.0.113.40

Look at the additional section of the first answer. The servers for shop.example.com are named ns1.shop.example.com and ns2.shop.example.com: they live inside the zone they serve. To find their addresses you would have to ask them, which you cannot do without their addresses. The parent breaks the loop by carrying copies of those addresses alongside the delegation. Those copies are called glue. This chapter only needs the rule: if a zone's name servers sit inside that zone, the parent must hold glue. How resolvers use glue, and why they must not trust it too far, is Chapter 3.

Go deeper: why delegate at all, and where cuts usually fall

Every TLD is a cut from the root, and every registered name is a cut from its TLD: registering example.com means asking for exactly one delegation, in the com zone, pointing at servers you choose. Below that, cuts are optional. Organizations make them when a different team, provider or set of servers should own a branch: a subsidiary's names, a cloud environment's internal names, a reverse-DNS block handed over by an internet provider (Chapter 7).

A cut is not free. Every one adds a step to a cold lookup, a second set of servers to keep running, and two copies of the NS set to keep in agreement. A name like a.b.c.example.com does not need a cut at every dot; a single zone can hold names as deep as you like. Delegate for ownership, not for tidiness.

Instrument 2

Cut the tree

Here is a small piece of the namespace. Click any name (or pick it from the list) to see which zone it belongs to, which servers are authoritative for it, and the chain of zones a resolver starting from nothing would pass through. Then press Delegate to make a zone cut at the selected name, or press it again to fold the branch back into its parent. Choose where each zone's name servers live, and the tool writes out the records that must exist on each side of the cut, and says when the parent needs glue.

Simulated data. Root and TLD server names are the real published ones (checked 22 October 2026); everything below the TLDs uses reserved example names and documentation addresses.

Name servers for the selected zone live
Belongs to zone–
Authoritative servers–
Zones in this tree–
Referral chain–

      
ZoneDelegated fromName serversGlue at the parent

Who may write what

The root, registries and registrars

Delegation answers the technical question of who answers for a name. There is a parallel, human question: who decides who gets which delegation? The answer is a chain of organizations, one per level near the top of the tree.

The root zone is the short list of every top-level domain and the servers for each. Changes to it go through the IANA functions, which have been performed since the 2016 stewardship transition by Public Technical Identifiers (PTI), an affiliate of ICANN. When a TLD operator wants to change its name servers, it files a request with IANA, which checks it; the root zone maintainer, Verisign, then edits the zone, signs it and publishes it to the root server operators (Chapter 9). The root zone does not hold a single second-level name. It knows only about TLDs.

Top-level domains come in kinds. Country-code TLDs (ccTLDs) are two letters taken from the ISO 3166-1 list of country codes, like .uk, .de and .jp, and each country's operator sets its own rules. Generic TLDs (gTLDs) include the originals, .com, .net, .org, and the hundreds of new gTLDs, such as .nyc, added through ICANN's program that opened in 2012. Generic registries operate under contracts with ICANN. There is also .arpa, kept for infrastructure such as reverse DNS.

Below the TLD, three roles split the work:

  • The registry runs the TLD: its database of registrations and its zone. Verisign is the registry for .com; every TLD has exactly one registry.
  • The registrar is the company you actually deal with. It sells you the name, collects your details and sends the registry your changes. For gTLDs, registrars are accredited by ICANN, and many registrars sell names in the same TLD.
  • The registrant is you: the person or organization that holds the registration and decides where it points.

Registrars talk to registries in the Extensible Provisioning Protocol, EPP, an XML protocol for creating, renewing and changing domain objects (RFC 5730). Your contact details live in the registry's and registrar's databases, published through WHOIS and its successor RDAP. They are not in the DNS. What actually lands in the TLD zone when you register a name is tiny: your NS records, glue if your servers sit inside your own domain, and a DS record if you sign your zone with DNSSEC (Chapter 11). Everything else about your name lives on the servers those NS records point to.

Registrantyou Registrarsells the name Registryruns the TLD TLD zoneNS + glue + DS IANA (PTI)approves changes Root zoneedited by the RZM Your DNS providerSOA, NS, A, MX, TXT: everything else EPPpublish TLD's NS in rootyou point NS here
Registering example.com writes three kinds of record into the com zone and nothing else. The arrow up from the TLD zone shows that the TLD itself is a delegation from the root.
StepWho actsWhat is created, and where
1. RegisterYou, through a registrarA domain object in the registry's database, with your contacts and an expiry date. Nothing changes in DNS yet beyond what the registrar sets by default.
2. Choose serversYou, at the registrarThe registrar sends an EPP update listing your name servers (and their addresses, if they are inside your own domain).
3. PublishThe registryNS records for example.com in the com zone, plus glue if needed. The com servers start referring resolvers to your servers.
4. Fill the zoneYou, at your DNS providerThe authoritative zone: SOA, the matching NS set, and your A, AAAA, MX, TXT records.
5. Sign (optional)You, then the registryYour provider signs the zone; you hand the DS record to the registrar, and the registry publishes it in the com zone.
Go deeper: changing DNS providers without an outage

Because the delegation lives at the registry and the data lives at your provider, a move has two halves that must overlap. Build the complete zone at the new provider first and check it by asking the new servers directly. Only then change the NS records at the registrar. For a while, resolvers that cached the old delegation keep asking the old servers, so leave the old zone running and identical until the TTL on the TLD's NS records (often a day or two for com) has passed. If the zone is signed, the DS record has to be handled in the same careful order, or validating resolvers will fail closed. Chapter 4 shows why the wait is what it is.

Reserved on purpose

Names that will never be sold

Some names are kept out of the market so that documentation, test networks and other naming systems have somewhere safe to live. RFC 6761 set up a registry of these special-use domain names, kept by IANA, and for each entry it records how every kind of software should treat it: users, applications, stub resolvers, caching resolvers, authoritative servers and registries. The point is that these names should be handled close to home and should not be sent up the tree. None of the special top-level names is delegated in the root zone, so even when a query does leak upward, the root answers that the name does not exist.

NameDefined inMeaningHow software should treat it
localhost.RFC 6761This machineAnswer with a loopback address (127.0.0.1, ::1) locally; never ask the network
invalid.RFC 6761A name guaranteed not to existAlways "no such name"; useful as an obviously fake placeholder
test.RFC 6761For testingFree for your own labs; no registry will ever sell a name in it
example.
example.com/.net/.org
RFC 6761 (first reserved in RFC 2606)For documentationSafe in books and code samples. The three second-level names do resolve, to a page run by IANA
local.RFC 6762Multicast DNS on the local linkAsk the local network by multicast, not the DNS (Chapter 10)
home.arpa.RFC 8375Names inside a home networkResolved by the home router; never meaningful outside it
onion.RFC 7686Tor onion servicesHandled by Tor software; applications should not look them up in the DNS at all
alt.RFC 9476Other, non-DNS naming systemsReserved so alternative namespaces have a place that can never collide with a real TLD

The registry also covers reverse-DNS zones for private address space, such as 10.in-addr.arpa and 168.192.in-addr.arpa, so that lookups for private addresses are answered locally instead of flooding public servers. Chapter 7 explains those names. This site uses only reserved names, the documentation addresses 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 and 2001:db8::/32, and public names like jelia.nyc, for exactly the reasons this registry exists.

Looks like DNS, is not

The Public Suffix List

Here is a question the DNS cannot answer: is co.uk a company's name, or a place where many companies register names? Both example.com and co.uk are two labels long and both are just nodes in the tree. Nothing in a DNS answer says "anyone can register beneath me". Browsers badly need to know, because cookies are scoped by domain. If a site at shop.example.co.uk could set a cookie for all of co.uk, it could read or plant cookies on thousands of unrelated businesses.

The Public Suffix List fills that gap. It is a plain text file, started by Mozilla and now kept as a community resource, that lists every known suffix under which the public can register names: com, co.uk, pvt.k12.ma.us, and thousands more. It has two sections: an ICANN section for suffixes run by registries, and a private section where companies list suffixes they hand out to customers, such as github.io, so that one customer's site cannot set cookies for another's.

The list gives rise to the idea of a registrable domain: one label plus the public suffix, like example.co.uk. Browsers use it for cookie boundaries and for deciding what counts as the "same site"; certificate authorities and mail software use it too. But it is not a DNS concept. It does not line up with zones (co.uk and uk may or may not be separate zones; the list does not care), it is not published in the DNS, and it changes on its own schedule. When a tool tells you the "domain" of a.b.example.co.uk is example.co.uk, it is reading this list, not asking the DNS.

NamePublic suffix (from the list)Registrable domainZone that answers (DNS)
www.example.comcomexample.comwhatever the example.com servers say: maybe example.com
shop.example.co.ukco.ukexample.co.ukfound only by asking: the list cannot tell you
alice.github.iogithub.io (private section)alice.github.iothe github.io zone: one zone, many "registrable domains"
Cheat sheet

Terms from this chapter

Label
One node's name within a domain name: www, example and com in www.example.com. At most 63 bytes.
Root (empty label)
The top of the tree. Its name is the empty label, written as the final dot and sent as a single zero byte.
FQDN
Fully qualified domain name: a name written all the way to the root, with the trailing dot, so nothing is left to guess.
LDH rule
The host-name rule: letters, digits and hyphen only, no hyphen at either end (RFC 1123). Stricter than DNS, which allows any byte.
Underscore label
A label starting with _, like _dmarc or _tcp. Legal DNS but never a host name, so it can carry service records without colliding with hosts.
U-label / A-label
The Unicode form of an internationalized label (bücher) and its ASCII form for the DNS (xn--bcher-kva).
Punycode
The encoding (RFC 3492) that turns a Unicode label into ASCII: basic letters first, then compact instructions for inserting the rest.
Zone
The part of the namespace one set of authoritative servers answers for: from an apex down to the next cuts.
Zone cut
The boundary where a parent delegates a child: NS records in the parent (not authoritative) matching NS records at the child's apex (authoritative).
Registry / registrar / registrant
The operator of a TLD; the company that sells names in it; the holder of a name.
Special-use name
A name in IANA's RFC 6761 registry, like .test, .localhost or home.arpa, reserved and handled locally rather than sold.
Public suffix
A suffix under which the public can register names (com, co.uk, github.io), from a list browsers use for cookie boundaries. Not a DNS concept.
Where this comes from

Sources