BIND zone files · lint and export

DNS Zone File Checker

Paste a BIND zone file to list its records and catch the mistakes that break a zone: a CNAME at the apex, MX pointing at a CNAME, names missing their trailing dot, differing TTLs inside a record set, malformed SPF and TXT records that are too long. Nothing is queried over the network.

Zone file

Drop a zone file

.zone, .db, .txt up to 8.0 MB

Paste a zone file, open one, or load the example.

DNS Zone File Checker

Operator: Abdulla Al Fahad. How tools are built and checked

Many broken zones come down to a single character. A hostname written without its trailing dot is silently extended with the zone name, so www IN CNAME example.org becomes www.example.org pointing at example.org.example.org, and nothing complains until the site stops loading.

This checker parses a BIND zone file the way a name server would: it applies $ORIGIN and $TTL, expands relative names, joins records split across parentheses, expands a bounded $GENERATE and handles quoted strings with escapes. Then it lints the result for the structural mistakes that DNS standards forbid and the operational ones that cause outages, and lists every record in a table you can export.

Nothing is queried. The page reads only the text you give it, so it cannot tell you whether the zone is delegated or the servers answer.

Key features

  • Parsing of $ORIGIN, $TTL, $GENERATE, relative and absolute names, owner inheritance, TTL units such as 1h30m, class IN, CH and HS, and the common record types
  • Structural checks: CNAME at the apex, CNAME beside other data, repeated CNAMEs, missing or duplicate SOA, missing apex NS, data outside the zone, bad labels and wildcards
  • Operational checks: names missing their trailing dot, MX and NS pointing at a CNAME, in-zone name servers with no address record, TTL differences inside a record set, duplicates, very low or very high TTLs
  • SPF and DMARC syntax checks, TXT size checks and a note on the retired SPF record type
  • CSV of all records, a findings report, JSON, and a one-record-per-line import file

How names, TTLs and parentheses are resolved before linting

A zone file is a list of resource records: owner name, optional TTL, optional class, type and data. An owner that is blank repeats the previous owner, @ means the origin, and a name ending in a dot is complete while any other name has the origin added. A TTL may be a number of seconds or a mix of units (1h30m is 5,400). Without a $TTL line a record with no TTL inherits the previous record's TTL; with one, it takes the default. Parentheses let a record span lines, and a semicolon outside quotes starts a comment.

The rules behind the errors come from the RFCs. A name that has a CNAME can have no other data (RFC 1034), so a CNAME at the apex, which always holds SOA and NS, is invalid. All records of one name and type must share a TTL (RFC 2181). An MX or NS target must be a name with address records, not an alias (RFC 2181 section 10.3). A single SPF TXT record is allowed per name, and its lookup-causing terms must stay within ten (RFC 7208).

How it works

The text is cut into logical lines first, tracking quotes, escapes such as \" and \044, comments and parenthesis depth, so a malformed zone fails with the line where a quote or parenthesis was left open. Decimal escapes are read as bytes and then decoded as UTF-8, so \195\169 in a TXT string reads as one é, and an unquoted \; in TXT data becomes a plain semicolon.

Records are then checked one rule at a time against indexes built from the whole zone: owners to their records, CNAME owners, and address records, so an MX target can be matched against the CNAMEs defined further down the file.

When to run it

  • An administrator moving 300 records between providers pastes the old zone and finds a CNAME that shares its name with an MX record. The old host tolerated it; the new provider would have rejected the import, and the finding gives the line to fix.
  • A team about to add a CDN checks that adding a CNAME for the apex would be invalid, and sees the apex NS and SOA records that would conflict with it.
  • A mail admin reviews a zone with 11 include: terms in one SPF record and sees that the record alone already needs 11 lookups against a limit of 10.

Running a check

  1. Paste the zone or drop a file, and type the origin only when the file has no $ORIGIN line; Load example fills in a small zone with deliberate mistakes.
  2. Press Check zone. The summary line gives the number of errors, warnings and notes.
  3. Work down the Findings list from errors to notes. Every entry cites the line it came from, so you can jump straight to it in your editor.
  4. Switch to Records to see each name expanded to its full form with the TTL it actually gets.
  5. On Export, download the CSV or the one-record-per-line import file.

Example

The bundled example.org zone (19 records)

www   IN CNAME example.org
mail2 300 IN CNAME mail.example.org.
      IN MX 20 mail2
      IN TXT "v=spf1 mx include:_spf.mailer.example ip4:203.0.113.0/24 ~all"
      IN TXT "v=spf1 a -all"
shop  60 IN CNAME shops.example.net.
shop  IN TXT "verification=abc123"
api   IN A 10.0.4.17
api   IN A 10.0.4.17
files IN A 203.0.113.40
files 7200 IN A 203.0.113.41

Findings: 8 in all (3 errors, 3 warnings, 2 notes), six shown

error   line 12  MX target mail2.example.org. is a CNAME in this zone
error   line 14  example.org. has 2 SPF TXT records
warning line 19  CNAME target example.org.example.org. contains the zone name twice
error   line 21  shop.example.org. has a CNAME and also a TXT record
warning line 24  Duplicate A record at api.example.org.
warning line 26  The A records at files.example.org. have different TTLs (3600, 7200)

Tips for best results

  • Fill in the origin field when a provider export has relative names and no $ORIGIN, because a name you meant as mail will otherwise be reported as unresolvable.
  • Filter Records by the SPF type to find stray SPF-type records, which have been obsolete since RFC 7208.
  • On the Records tab, a TTL marked (inherited) came from $TTL or from the previous record; that is the usual source of a TTL nobody meant to set.

Limits

A zone can pass every check and still not work: delegation at the parent, glue records and the actual servers are outside the file.

The SPF check counts only the terms in the record you give it. Terms inside included records are not followed, so the real lookup count can be higher.

Names are shown in lower case. DNS compares names without regard to case, but a provider that preserves the original case will show it differently.

$INCLUDE is not followed because the page cannot read other files; paste the included text into the zone.

Common errors and how to fix them

"Line 1 uses the relative name \"www\" but no zone origin is known."
The file has relative names and neither a $ORIGIN line nor an absolute SOA owner to take the origin from. Type the zone name in the origin field.
"A quoted string that starts on line 14 is never closed."
A TXT value is missing its closing quote. A quote inside the value must be written as \" so it is not read as the end.

Best practices

  • Give every record in an RRset the same TTL and keep $TTL at the top, so that a record without a TTL inherits it deliberately.
  • Write every target name with a trailing dot, even inside your own zone, so a missing dot is never ambiguous.

The import file

Managed DNS dashboards that accept a zone file read a plain layout best: one record per line, full names, an explicit TTL on each line and no directives. The Export tab writes that layout. It expands $GENERATE, gives every record a TTL (using the number you enter when a record had none), splits TXT strings longer than 255 bytes into several quoted strings (never inside a multi-byte character) and, if you leave the option on, leaves out the apex SOA and NS records that a hosted provider creates for itself.

The JSON export lists the same records as objects with type, name, content and ttl, with MX priority separated and SRV and CAA values placed in a data object. It is a neutral shape that scripts can map onto a provider's API.

What the TTL notes mean

A TTL under 60 seconds is shown as a note because it multiplies the number of queries your name servers answer, and above seven days because a mistake would stay cached for that long. The SOA minimum field is the negative-caching TTL (RFC 2308); when it is above a day, a wrong NXDOMAIN answer would be remembered that long, and the check reports that too.

Frequently asked questions

Why is a CNAME at the apex an error when some providers allow it?

Those providers synthesise an A or AAAA answer behind the scenes, a feature called ALIAS or CNAME flattening. In a standard zone file a CNAME at the apex conflicts with the required SOA and NS, so the checker reports it; whether a given provider flattens it is outside the file.

Does it check SPF records beyond syntax?

It checks the syntax of the record you give it, flags +all, ptr, terms after all and a count of lookup terms over ten. It does not look up included records, so it cannot tell you what an include: resolves to.

Can it check a reverse zone?

Yes. PTR records and $GENERATE lines such as $GENERATE 1-4 $ PTR host-$.example. are parsed; the structural checks apply to the reverse zone in the same way.