Skip to content
hostcomplex

DNS Zones and Zone Files

Maarten Soetens 3 min read

What a zone is

A DNS zone file is a plain-text file that lists the DNS records for one zone. A zone is a part of the DNS namespace that a single administrator manages as one unit.

A zone is not always the same as a domain. A domain is the whole branch of the namespace under a name, such as example.com, including every subdomain below it. A zone is the part one administrator controls, and a domain can be split into several zones. For example, the owner of example.com might keep the main zone while a separate team or provider manages the zone for dev.example.com. The main zone then contains an NS record that delegates dev.example.com to the other zone. For most small websites, one domain and one zone are the same thing.

How a zone file is structured

A zone file usually begins with a few directives. The $ORIGIN line sets the domain that unqualified names are relative to, and $TTL sets the default time to live for records. Next comes the SOA record, which is mandatory. It describes the zone itself, including its primary nameserver, a contact address and a serial number that changes whenever the zone is edited. The details are in what an SOA record is.

After the SOA record come the NS records and the data records, one per line. A typical line lists the name, the record class, the type and the value, for example www IN A 192.0.2.10. Within a zone whose origin is example.com, this reads as the name www.example.com pointing to the IPv4 address 192.0.2.10. The individual record types are described in the common DNS record types.

Why zone files matter for hosting

Most hosting control panels and DNS dashboards hide the zone file. You edit records in a form, and the provider writes the file for you. Knowing the format still helps. It makes exports easier to read, explains why a single typo such as a missing trailing dot can change a record's meaning, and clarifies how a zone moves between servers.

Zone copies are also how redundancy works. A primary server holds the master copy of a zone, and secondary servers receive copies through zone transfers, so several servers can answer for the same domain. This setup is described in primary vs secondary DNS and zone transfers.

Frequently asked questions

Is a zone file the same as a DNS record?

No. A zone file is the complete text file that contains every record for a zone. A DNS record is a single entry inside that file, such as one A record or one MX record. Each record describes one piece of information about one name.

Can a domain have more than one zone file?

Yes. A domain is divided into zones wherever part of its namespace is delegated to another set of nameservers. Each zone has its own zone file on the servers responsible for it. The parent zone still holds the delegation records that point to the child zone, so resolvers can follow the chain from one file to the next.

  • Two-Factor Authentication

    Two factor authentication hosting adds a second check to control panel, domain and CMS logins. Learn which methods are strongest and why 2FA helps.

  • What Is an A Record?

    What is an A record? Learn how this DNS record maps a hostname to an IPv4 address, why domains use several A records and the root and www pattern.

  • Billing and Automation Platforms

    What is WHMCS? Learn how this commercial billing and automation platform helps hosts sell plans, collect payments and create accounts automatically.