DNS Zone File Generator – Build BIND-Compatible Zone Files Online
A DNS zone file is the authoritative text file that an authoritative name server reads to answer queries for a domain. Every record for your domain lives in this file: where your web server is (A record), where your mail goes (MX record), what subdomains are aliases (CNAME records), and custom verification or policy text (TXT records). This generator lets you build a complete, standards-compliant zone file interactively — then copy or download the output to deploy on any DNS server that speaks the BIND zone file format, including BIND 9, PowerDNS, NSD, and Knot DNS.
Anatomy of a DNS Zone File
A zone file begins with two directives that set defaults for the entire file, followed by the mandatory SOA record, and then the individual DNS records:
$ORIGIN example.com.
$TTL 3600
@ IN SOA ns1.example.com. hostmaster.example.com. (
2026061201 ; serial
3600 ; refresh
900 ; retry
604800 ; expire
300 ) ; minimum TTL
@ IN NS ns1.example.com.
@ IN NS ns2.example.com.
@ IN A 203.0.113.1
www IN A 203.0.113.1
@ IN MX 10 mail.example.com.The $ORIGIN directive sets the base domain, so bare names like www expand to www.example.com.. The $TTL directive sets the default cache lifetime in seconds for records that do not specify their own TTL. The @ symbol is shorthand for the current origin (i.e., your domain root).
The SOA Record Explained
The SOA (Start of Authority) record is required in every zone and tells the DNS ecosystem who is in charge of the zone. It contains six key values:
| Field | Typical Value | Meaning |
|---|---|---|
| Primary NS | ns1.example.com. | The authoritative primary name server for the zone |
| Admin Email | hostmaster.example.com. | Administrator email — @ replaced with a dot |
| Serial | 2026061201 | Version counter; must increase on every zone update |
| Refresh | 3600 | How often secondary servers check for updates (seconds) |
| Retry | 900 | How long to wait before retrying a failed refresh (seconds) |
| Expire | 604800 | How long secondaries serve stale data if primary is down |
| Minimum TTL | 300 | Negative caching TTL — how long NXDOMAIN is cached (RFC 2308) |
Common DNS Record Types
The generator supports the most widely used record types. Here is a quick reference:
| Type | Purpose | Example Value |
|---|---|---|
| A | Maps a hostname to an IPv4 address | 203.0.113.1 |
| AAAA | Maps a hostname to an IPv6 address | 2001:db8::1 |
| MX | Designates mail servers (with priority) | 10 mail.example.com. |
| CNAME | Alias from one hostname to another | example.com. |
| TXT | Arbitrary text — used for SPF, DKIM, verification | v=spf1 ~all |
| NS | Delegates a zone or subdomain to a name server | ns1.example.com. |
Trailing Dots and FQDNs
One of the most common sources of zone file errors is missing or misplaced trailing dots. A hostname without a trailing dot is relative — the DNS server appends the $ORIGIN to it. A hostname with a trailing dot is an FQDN (Fully Qualified Domain Name) and is treated as absolute. The generator automatically adds trailing dots to absolute hostnames in the CNAME, NS, MX, and SOA target fields, eliminating this class of error.
Serial Number Best Practices
The recommended serial format is YYYYMMDDNN, where NN is a two-digit counter starting at 01 and incrementing each time you publish a new version of the zone on the same day. For example, 2026061201 is the first revision on 12 June 2026. Secondary name servers compare serial numbers to decide whether to fetch a new copy of the zone — the serial must always increase. If you accidentally set a lower serial, secondaries will stop syncing until you advance past the previously seen value.
Setting Up Email with MX and TXT Records
To receive email at your domain you need at least one MX record pointing to your mail server, and optionally a TXT record for the SPF policy that authorizes which servers may send on your behalf. For example, if you use Google Workspace, your records would look like:
@ 3600 IN MX 1 aspmx.l.google.com.
@ 3600 IN MX 5 alt1.aspmx.l.google.com.
@ 3600 IN TXT "v=spf1 include:_spf.google.com ~all"Lower MX priority values are tried first. Multiple MX records at different priorities give you both load distribution and failover — clients try the lowest priority server first and fall back to higher values if it is unreachable.
Deploying Your Zone File
After generating your zone file, copy the output into your DNS server configuration: for BIND 9, place it in the directory referenced by your named.conf zone block and run rndc reload. For PowerDNS, import it using pdnsutil load-zone. If you use a cloud DNS provider such as Cloudflare or Route 53, import the file through their zone import feature — both accept standard BIND-format zone files. Always verify the zone with named-checkzone example.com example.com.zone before loading to catch syntax errors.