A zone file is the complete set of DNS records for a domain, stored as a text file on its nameservers.

A zone file is the master list of DNS records for a domain. It tells the internet where your website lives, which servers handle your email, and anything else connected to your domain. It's stored on your domain's authoritative nameservers, and every DNS lookup for your domain is answered from it.

Under the hood it's a plain text file in a standard format, with one record per line. Most people never see the raw file, because hosting and DNS panels show the records as an editable table. Either way, it's the same data.

What's in a zone file

A typical zone file contains:

  • SOA record: the start of authority, with the primary nameserver, the administrator's email, a serial number and timing settings
  • NS records: the nameservers responsible for the domain
  • A records and AAAA records: map names to IPv4 and IPv6 addresses
  • CNAME records: point one name at another
  • MX records: say which servers accept email for the domain
  • TXT records: hold text, used for SPF, DKIM, DMARC and domain verification
  • Other records, such as SRV and CAA

Each record also has a TTL (time to live), which tells resolvers how long they may cache it.

A simple zone file example

$TTL 3600
example.com.   IN  SOA    ns1.example.net. admin.example.com. 2026100601 7200 3600 1209600 3600
example.com.   IN  NS     ns1.example.net.
example.com.   IN  A      192.0.2.10
www            IN  CNAME  example.com.
mail           IN  A      192.0.2.20
example.com.   IN  MX     10 mail.example.com.

The trailing dot at the end of a name means it's complete. Without it, the zone's own domain is added automatically, which is why www becomes www.example.com.

How zone file changes take effect

When you edit a record, the authoritative nameservers start serving the new value almost straight away. But resolvers around the world may have cached the old value, and they keep using it until its TTL runs out. That's why DNS changes can take minutes to hours to be seen everywhere.

Zone file vs nameservers vs registrar

Your registrar records which nameservers are authoritative for your domain. Those nameservers hold the zone file. If you change nameservers, for example to move DNS to a CDN, the zone file at the old provider stops being used, so copy every record to the new provider first. Exporting the zone file makes this easy.

Common zone file mistakes

  • Forgetting MX or TXT records when moving DNS, which breaks email
  • Conflicting records for the same name, such as a CNAME alongside an A record
  • Missing trailing dots in raw zone files, producing names like www.example.com.example.com
  • Editing the zone at a provider that isn't actually authoritative, so nothing changes

Zone file questions

Where is my zone file stored?
On your domain's authoritative nameservers, which are usually run by your host, your registrar or a separate DNS provider such as a CDN.
Can I export my zone file?
Usually yes. Most DNS panels can export the zone in the standard text format, which you can import at a new provider when you move DNS.
How long do zone file changes take to work?
The nameservers update almost immediately, but cached copies elsewhere last until the record's TTL expires, usually minutes to a few hours.
Was this definition helpful?
Share this definition