All Glossary Terms

Glossary

DNS Zone File

The text file that defines all DNS records for a domain

A DNS zone file is a plain-text file in BIND format (RFC 1035) that contains all the DNS resource records for a specific domain or zone, including SOA, NS, A, MX, TXT, CNAME, and other record types, and is served by an authoritative nameserver.

What is a DNS Zone File?

A DNS zone file is the master record of all DNS information for a specific domain. It is a plain-text file that follows a standardised format originally defined in RFC 1035 and associated standards, commonly referred to as the BIND zone file format (after the BIND nameserver software that popularised it). The zone file contains every DNS resource record for the domain, specifying how the domain name maps to IP addresses, mail servers, and other services.

A zone file begins with the SOA (Start of Authority) record, which defines the primary nameserver, the contact email for the zone administrator, and timing parameters for zone transfers and negative caching. This is followed by NS records for the authoritative nameservers, and then all other resource records: A records for IPv4 addresses, AAAA records for IPv6, MX records for mail servers, TXT records for SPF and other verifications, CNAME records for aliases, and so on.

Zone files are the canonical data source for authoritative nameservers. Any change to DNS records ultimately begins with a modification to the zone file on the primary nameserver.

Zone File Structure and Syntax

A zone file entry (resource record) has five fields: the name (the hostname or "@" for the zone apex), TTL (time to live in seconds), class (almost always "IN" for Internet), type (A, MX, TXT, etc.), and rdata (the record-specific data such as an IP address or mail server hostname).

The SOA record contains six timing values: the serial number (which must be incremented every time the zone is changed to trigger zone transfers to secondaries), refresh interval (how often secondaries check for updates), retry interval (how long a secondary waits before retrying a failed refresh), expire value (how long a secondary serves the zone data if it cannot reach the primary), and negative TTL (how long negative responses are cached).

Relative names in a zone file are automatically appended with the zone's origin domain. An entry of "mail" in a zone file for "example.com" refers to "mail.example.com." Absolute names must end with a trailing dot (e.g., "mail.example.com.") to prevent the zone origin from being appended.

How to Validate a DNS Zone File

You can validate and analyse a DNS zone file using the DNS Zone Validator at nslookup.net/tools/dns-zone-validator. Upload or paste your zone file and the tool will parse the syntax, check for missing required records (SOA, NS), validate record formats, flag duplicate entries, and highlight common configuration errors.

Validating a zone file before deploying it to your nameservers prevents zone loading failures that could make your domain unreachable. Most nameserver software also includes command-line tools (such as "named-checkzone" in BIND) for local validation before deployment.

Related Tool

DNS Zone Validator

Try the Tool →

Frequently Asked Questions

What is the SOA serial number and why does it matter?
The SOA (Start of Authority) serial number is an integer that indicates the version of the zone file. Secondary nameservers compare the primary's SOA serial number with their own copy during zone refresh checks; if the primary's serial is higher, the secondary initiates a zone transfer to get the updated data. The serial number must be incremented every time the zone is modified, otherwise secondary servers will not detect the change and will continue serving stale data.
Can I edit a DNS zone file directly with my hosting provider?
Most DNS hosting providers present a graphical interface for managing DNS records rather than exposing the raw zone file. However, many providers allow you to export the zone file in BIND format and some allow direct import or editing. Self-hosted BIND, PowerDNS, and similar nameserver software support direct zone file editing. After editing, the SOA serial must be incremented and the nameserver reloaded.
What is a wildcard DNS record?
A wildcard DNS record uses an asterisk as the leftmost label (e.g., "*.example.com") to match any hostname within the zone that does not have an explicit record. For example, a wildcard A record "*.example.com IN A 192.0.2.1" causes any query for "anything.example.com" to return 192.0.2.1, unless a more specific record exists. Wildcards are commonly used for web hosting platforms and services that generate many subdomains dynamically.
What is the difference between a zone and a domain?
A domain is a node in the DNS namespace hierarchy, such as "example.com." A zone is an administrative unit of DNS that may encompass a domain and some or all of its subdomains, depending on where authority has been delegated. For example, "example.com" and "sub.example.com" can be in the same zone, or "sub.example.com" can be delegated to its own separate zone with its own SOA and NS records. A zone file corresponds to a single zone.