Skip to content
MigrationsProviders

How to export a DNS zone file from Cloudflare, Route 53, GoDaddy, Azure and more

Export a DNS zone file from Cloudflare, Route 53, GoDaddy, Azure DNS, Google Cloud DNS, Namecheap and more, with provider steps and export limits.

10 min readDNSMigrator team

An export is a snapshot, not proof that another provider can reproduce the zone. Save the untouched source, record when you took it, and do not change the live zone while you validate the copy. If this is preparation for a move, start with the DNS migration checker as well as the file.

Export DNS zone file data safely#

Prefer the source provider's own export over scraping its dashboard or copying public answers. Public DNS cannot reveal unqueried names, and a proxied or flattened answer may not contain the configured target. A provider API can also expose metadata that BIND has no standard field for.

Use the current provider-specific path below. Commands use documentation names such as example.com; replace IDs, resource groups, projects, and file paths with yours. Never paste an API token directly into shell history.

Provider exports: Cloudflare, Route 53, Azure, and more#

For a Cloudflare export DNS zone file, open the zone's DNS Records page, select Import and Export, then select Export. Cloudflare's current import and export documentation says the download is BIND format.

The API equivalent requires a token with DNS Read or DNS Write and the zone ID:

bash
curl --fail --silent --show-error \
  "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records/export" \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --output example.com.zone

Cloudflare now writes comments, tags, cf-proxied state, and per-record flattening into semicolon comments with reserved cf- tags. DNSMigrator's zone-file parser treats those annotations as comments and does not preserve them, so use a Cloudflare API connection when proxy or comment metadata matters. That connection can also read and push supported Redirect Rules and Worker routes, but its token needs Zone → Single Redirect → Edit and Zone → Workers Routes → Edit in addition to DNS access. Page Rules, load balancers, and other application features remain separate. Review what changes when leaving Cloudflare and the Cloudflare connection guide.

What DNS exports miss#

A BIND file represents resource records: owner, TTL, class, type, and RDATA. It does not have standard fields for these common provider features:

  • Cloudflare proxying and other private DNS flags unless software understands its cf- comments. A BIND file cannot carry Redirect Rules, Worker routes, Page Rules, load balancers, or account settings; DNSMigrator reads its supported redirect and route types through the Cloudflare API instead.
  • Route 53 aliases, health checks, weighted, latency, geolocation, geoproximity, failover, multivalue, and traffic-policy relationships. AWS JSON is the lossless source for those fields.
  • Azure resource aliases and Google Cloud routing policies.
  • Registrar URL forwarding, email forwarding, synthetic records, or templates.
  • Record comments, tags, ownership labels, protection flags, and audit history unless a provider emits a private convention.

Exports may also contain DNSSEC-generated DNSKEY, RRSIG, NSEC, or NSEC3 data. Do not copy an old provider's signatures into a newly signed destination. Plan the chain-of-trust change with the DNSSEC migration guide and check it with the DNSSEC checker.

Handle SOA and NS records deliberately#

The apex SOA and authoritative NS records describe the current provider. Most managed destinations create their own versions when the zone is created. Importing the old apex set can conflict, fail, or advertise servers that do not host the new zone. Remove or replace them only according to the destination's import documentation.

Delegation NS records below the apex are different: they may intentionally hand a child zone to other servers and usually must move. Glue A or AAAA records may matter too. Do not apply a blanket “delete every NS line” rule.

Comments beginning with ; are legal master-file comments, but they are not DNS answers. Some exporters preserve them, some synthesize them, and some discard them. Never make a migration depend on a comment surviving.

Validate and translate the file before import#

Keep the untouched export

Store the original BIND, JSON, YAML, or XML response beside its timestamp. Make edits in a copy so you can always return to the provider's exact output.

Parse the zone file

Paste the copy into the zone file validator. It catches malformed directives, missing origins, unsupported record types, and broken parentheses, then emits fully qualified names that help you spot relative-target mistakes before they reach a provider. The BIND zone file format guide explains every column.

Translate for the destination

Use the zone translator to see which records stay exact, which need a provider representation, and which cannot be carried in BIND. Resolve warnings rather than deleting unfamiliar lines.

Compare control plane and DNS answers

Compare source and candidate data with the DNS record diff, then query the new nameservers directly. The dig command examples show how to require an authoritative answer before delegation.

Export DNS records to CSV only for review#

CSV is not a DNS interchange standard. It has no agreed schema for multi-value RRsets, quoted TXT strings, aliases, routing policies, or provider metadata. Do not convert a zone file to CSV with whitespace splitting: spaces are valid inside TXT and several RDATA formats.

If you need a spreadsheet inventory, convert a structured API response with explicit columns and keep the source JSON. For Cloudflare, the official list API allows up to 5,000,000 records per page and returns name, type, ttl, content, proxied, and comment. This review-only conversion preserves each API content string as one CSV field:

bash
curl --fail --silent --show-error \
  "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records?per_page=5000000" \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" |
jq -r '
  ["name", "type", "ttl", "content", "proxied", "comment"],
  (.result[] | [.name, .type, .ttl, .content, (.proxied // false), (.comment // "")])
  | @csv
' > records.csv

That CSV intentionally omits tags, settings, timestamps, and other metadata. It is a report, not a restorable backup. For other providers, define a provider-specific schema rather than pretending all JSON record objects have the same shape.

Use AXFR or IXFR as a read-only source#

If the provider has no useful export but an authoritative primary permits transfers, choose Zone transfer as the source. A connection accepts up to five public primary servers in failover order and optional TSIG credentials. It is read-only: DNSMigrator can migrate from it, monitor it, and back it up, but never offer it as a destination or write back to the primary.

The first read uses AXFR. With Prefer IXFR for change checks, later drift and backup work compares the SOA serial and requests an IXFR delta, falling back to AXFR when the server cannot provide one. Transfers larger than 10 MB are refused. See the Zone transfer provider guide for ACL and TSIG setup.

A transfer is not a lossless control-plane export. The preview's What the zone transfer can't show section flags likely Cloudflare proxy addresses, possible flattened apex aliases, Cloudflare transfer omissions, stripped DNSSEC signing records, and record types the transfer could not carry. Use the provider API instead when those controls matter.

When DNSMigrator can skip the file#

A zone file remains useful for an archive or an offline source. For a provider-to-provider move, DNSMigrator can instead connect to the source provider, read configured records and supported metadata through its API, normalize them, and preview destination translations. If API access is unavailable, an authorized Zone transfer connection can be the read-only source.

Preview and migration apply do not write the source. The optional cutover TTL-lowering step is the one explicit exception for writable provider connections; a zone-transfer connection can never make that change, so lower TTLs at the primary separately. Otherwise, follow the quickstart: connect source and destination, preview, apply, verify the destination authorities, then cut over. Keep an independent export when one exists; a migration plan and a backup answer different questions.

How do I export a DNS zone file?
Use your DNS provider's BIND export or documented CLI command, then save the untouched result. If the provider only exports JSON, keep that JSON and use a tested converter rather than splitting text into record columns.
Can I export DNS records from Cloudflare?
Yes. In DNS Records, choose Import and Export → Export, or call GET /zones/{zone_id}/dns_records/export with DNS Read. Cloudflare includes some private state as cf- tags, but non-DNS features still need a separate inventory.
How do I export a DNS zone from Route 53?
Route 53 does not provide a console BIND download. Save aws route53 list-resource-record-sets JSON for a lossless control-plane inventory; use cli53 export --full only when you also need a BIND-like conversion.
Can I export Namecheap DNS as a zone file?
Namecheap does not currently document a BIND export for registrar-hosted BasicDNS or PremiumDNS. Its zone download instructions apply to cPanel hosting, so use the Namecheap API, DNSMigrator's provider connection, or a carefully compared manual inventory instead.
Can I export DNS records to CSV?
You can create a CSV report from structured provider JSON, but CSV is not a portable DNS format. Keep the original JSON or zone file, use explicit columns, and never rely on the CSV to restore aliases, routing policies, comments, or multi-string TXT structure.
Can DNSMigrator use AXFR instead of a zone file?
Yes. Its read-only Zone transfer source accepts up to five primaries and optional TSIG, uses AXFR for the full read, and can request IXFR for later change checks. Review transfer-loss warnings because provider-only settings are not present on the DNS wire.