XiaTools

Cloudflare DNS Dashboard Guide for Implementing Secure TXT Records

Updated 13 Oct 2026

Setting up Cloudflare DNS TXT records correctly is essential for domain ownership verification, email authentication protocols like SPF, DKIM, and DMARC, and various security services. This comprehensive guide walks you through navigating the Cloudflare dashboard, formatting various types of TXT records, and troubleshooting common validation failures. By the end of this tutorial, you will have the confidence to manage your DNS records securely and efficiently.

Before you make any updates to your production domain, it is best practice to run a diagnostic using the Email Security Checker to identify existing gaps in your domain's authentication posture and verify your changes afterward.

Understanding Cloudflare DNS TXT Records

A TXT (Text) record is a type of resource record in the Domain Name System that allows domain administrators to insert arbitrary text into the DNS. While originally used for human-readable notes, TXT records are now heavily utilized for machine-readable data, primarily security policies.

Cloudflare handles DNS management through a streamlined web interface and a robust API. When managing TXT records in Cloudflare, understanding record length limitations, encoding rules, and proxy status is critical to ensuring your configurations function properly across the global internet.

Key Characteristics of TXT Records

  • No Traffic Routing: Unlike A or CNAME records, TXT records do not direct network traffic or point to IP addresses like 192.0.2.1.
  • Multiple Strings: Standard DNS allows a TXT record to contain multiple character strings, which Cloudflare stitches together or splits depending on total length.
  • No Orange Cloud (Proxy): TXT records in Cloudflare are strictly DNS-only. You cannot proxy TXT record lookups through Cloudflare's edge network, meaning the gray cloud icon is always active for these records.

Step-by-Step Cloudflare DNS TXT Records Setup

Follow these sequential steps to add, edit, or remove TXT records within the Cloudflare dashboard.

Step 1: Log in and Navigate to DNS Settings

  1. Open your web browser and navigate to the Cloudflare dashboard.
  2. Log in using your credentials and select the target domain (e.g., example.com) from your account overview.
  3. In the left-hand sidebar menu, locate and click on DNS, then select Records from the sub-menu.

Step 2: Add a New TXT Record

  1. Click the blue Add record button located near the top right of the DNS records table.
  2. From the Type dropdown menu, select TXT.
  3. In the Name field, enter your desired subdomain or use @ to apply the record to your root domain (example.com).
  4. In the Content field, paste your exact TXT record value, ensuring there are no hidden line breaks or illegal characters.
  5. Leave the TTL (Time to Live) set to Auto (or choose a specific duration if required by your hosting strategy).
  6. Click Save to commit the record to your zone.
Type: TXT
Name: @
Content: v=spf1 include:_spf.example.com ~all
TTL: Auto

Configuring Common Security TXT Records

Different security frameworks require precise syntax inside your TXT records. Below are the most common implementations you will manage in the Cloudflare dashboard.

SPF (Sender Policy Framework)

SPF records declare which mail servers are authorized to send email on behalf of your domain. Note that a domain must only have a single SPF record; multiple records will cause validation to fail.

Name: @
Content: v=spf1 ip4:192.0.2.0/24 include:mail.example.com ~all

DKIM (DomainKeys Identified Mail)

DKIM adds a cryptographic signature to your emails. The provider you use for email hosting (such as Google Workspace or Microsoft 365) will supply a specific selector name.

Name: selector1._domainkey
Content: v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQFAAOCAQ8AMIIBCgKCAQEA...

DMARC (Domain-based Message Authentication, Reporting, and Conformance)

DMARC builds upon SPF and DKIM, telling receiving servers how to handle emails that fail authentication checks.

Name: _dmarc
Content: v=DMARC1; p=reject; sp=quarantine; rua=mailto:dmarc-reports@example.com; pct=100

Verification and Troubleshooting

Once you save your TXT records in Cloudflare, changes usually propagate globally within a few seconds due to Cloudflare's high-performance authoritative nameservers. However, local caching by ISPs or recursive resolvers can cause delays.

Using Command Line Tools

You can verify your DNS records directly from your local terminal using standard utilities.

Using dig to query a TXT record:

dig TXT example.com +short

Using nslookup on Windows PowerShell:

Resolve-DnsName -Name example.com -Type TXT

Using curl to check DNS over HTTPS via Cloudflare:

curl -s -H 'Accept: application/dns-json' 'https://cloudflare-dns.com/dns-query?name=example.com&type=TXT' | jq .

Comparison: Cloudflare DNS vs Traditional Registrars

Feature Cloudflare DNS Traditional Registrar DNS
Propagation Speed Instantaneous (global edge) Often 15 minutes to 4 hours
API Access Highly robust REST API Limited or proprietary
Record Limits Generous limits for all plans Varies wildly by provider
Security Add-ons DNSSEC, CAA support built-in Basic or requires extra fees

Common Mistakes and How to Fix Them

  1. Wrapping Values in Double Quotes: Cloudflare automatically manages quotation marks for standard TXT strings. Manually wrapping your content in quotes inside the dashboard can result in double-quoted strings that fail validation.
  2. Exceeding Character Limits: Standard DNS strings are limited to 255 characters per chunk. If your DKIM key is extremely long, split it into multiple quoted strings or let Cloudflare handle the chunking automatically during paste.
  3. Creating Multiple SPF Records: Having two separate TXT records starting with v=spf1 invalidates your SPF configuration entirely. Combine all authorized senders into a single record.
  4. Typo in Subdomain Names: Omitting the leading underscore in records like _dmarc or selector._domainkey prevents mail servers from discovering your security policies.

Cloudflare DNS TXT Setup Checklist

  • Logged into the correct Cloudflare account and selected your domain
  • Verified that the record type is explicitly set to TXT
  • Confirmed the host name uses the correct syntax (e.g., _dmarc or @)
  • Checked that string values do not contain conflicting manual quotation marks
  • Tested propagation using dig or an online validation utility
  • Ensured only a single SPF record exists for the domain apex

Frequently asked questions

How long do Cloudflare TXT records take to update?

Cloudflare updates its authoritative nameservers almost instantly. Most global changes propagate in less than ten seconds, though recursive resolvers and client applications may cache previous results for the duration of the TTL.

Can I use the orange proxy cloud for TXT records in Cloudflare?

No, TXT records cannot be proxied through Cloudflare's edge network. The status icon for all TXT records remains permanently set to DNS-only (gray cloud), which is standard behavior for non-routing DNS record types.

What should I do if my SPF record exceeds 255 characters?

Cloudflare automatically handles long strings by splitting them into chunks permitted by DNS specifications. You can safely paste your complete SPF string into the content box, and Cloudflare manages the formatting in the background.

Why is my DMARC record failing validation after setup?

Validation failures are usually caused by a missing underscore in the record name field, syntax typos within the policy tags, or lack of a foundational SPF or DKIM implementation on the domain.

Can I have multiple TXT records with the exact same name?

Yes, you can have multiple TXT records assigned to the same name, such as having both a Google site verification record and a Microsoft domain ownership record at the apex. However, you should never have multiple SPF records under the same name.

Related articles

Free tools