Import and export records · Cloudflare DNS docs (2024)

Use import and export to have more control over your DNS records and make processes like migrating a domain or bulk editing record comments easier.

​​Import records

​​Format your zone file

Create a BIND zone fileOpen external link for your domain. If you need help, use a third-party toolOpen external link.

If you are using certain record types — for example, CNAME, DNAME, MX, NS, PTR, or SRV records — make sure that the content of those records contains fully qualified domain names (which end in a trailing period like example.com.). For more details, refer to RFC 1035Open external link or this post on Stack ExchangeOpen external link.

​​Import zone file to Cloudflare

To import a zone file using the dashboard:

  1. Log in to the Cloudflare dashboardOpen external link and select your account and domain.
  2. Go to DNS > Records.
  3. Select Import and Export.
  4. For Import DNS records, select your formatted file.
  5. If you do not want applicable records proxied, unselect Proxy imported DNS records.

​​Export records

You can also bulk export records from Cloudflare.

To export records using the dashboard:

  1. Log in to the Cloudflare dashboardOpen external link and select your account and domain.
  2. Go to DNS > Records.
  3. Select Import and Export.
  4. Select Export.

​​DNS record attributes

When exporting or importing a zone file, Cloudflare formats comments and tags using the following structure, appending the attributes as inline comment using the ; character after each record in accordance with RFC 1035 section 5Open external link:

CombinationDescription
Only tagsTag names contain a small set of characters.

Additionally, tag values must be contained by a double quote (") if they contain ", =, ,, or \. When enclosed within double quotes ("), tag values are represented as JSON strings, so other quotes within the value can be escaped as \".

A tag with an empty value can be represented either as my-tag-name:"", my-tag-name:, or my-tag-name.

Only a commentComments have fewer limitations on characters, meaning that the comment is included verbatim.

If the comment includes the string cf_tags=, you need to include an additional cf_tags= at the end of the line.

Comment and tagsThe zone file comment would be of the form ; <comment> cf_tags=<tags>, as described above. Note the added space character before cf_tags=.
Neither attributeThe comment in the zone file may be empty or omitted entirely. Comments in the zone file that do not immediately follow a record are also ignored.
Example zone file

; Only tags

a.example.com. 60 IN A 1.1.1.1 ; cf_tags=awesome

b.example.com. 60 IN A 1.1.1.1 ; cf_tags=tag1,tag2:value2,tag3:"value,with,commas",tag4:"value with \"escaped\" quotation marks"

; Only a comment

c.example.com. 60 IN A 1.1.1.1 ; just a comment without tags

d.example.com. 60 IN A 1.1.1.1 ; this comment contains cf_tags= as text cf_tags=

; Comments and tags

e.example.com. 60 IN A 1.1.1.1 ; simple example cf_tags=important,ticket:THIS-12345

f.example.com. 60 IN A 1.1.1.1 ; this is the comment cf_tags=tag1:value1,tag2:value2,tag-without-value,another-tag-without-value,tag-with-quoted-value:"because of the comma, quotes are needed"

; Neither attribute

g.example.com. 60 IN A 1.1.1.1

Import and export records · Cloudflare DNS docs (2024)
Top Articles
Latest Posts
Article information

Author: Prof. An Powlowski

Last Updated:

Views: 6418

Rating: 4.3 / 5 (64 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Prof. An Powlowski

Birthday: 1992-09-29

Address: Apt. 994 8891 Orval Hill, Brittnyburgh, AZ 41023-0398

Phone: +26417467956738

Job: District Marketing Strategist

Hobby: Embroidery, Bodybuilding, Motor sports, Amateur radio, Wood carving, Whittling, Air sports

Introduction: My name is Prof. An Powlowski, I am a charming, helpful, attractive, good, graceful, thoughtful, vast person who loves writing and wants to share my knowledge and understanding with you.