This guide walks you through adding the email security settings your domain needs — DMARC, SPF, and DKIM — using Cloudflare. These are entries in your domain’s public directory (called DNS records) that help email providers verify messages really come from you. Cloudflare is one of the most popular places to manage these settings, with free DNS hosting and near-instant updates.
📋 Before You Start
Make sure you have:
- A Cloudflare account with your domain added
- Your domain’s nameservers pointing to Cloudflare (e.g.,
ada.ns.cloudflare.com) - Your DMARC record value — use our DMARC Record Generator if you don’t have one
- Your SPF record value — check your email provider’s documentation for the correct
include:statements
Step 1: Add Your DMARC Record
- Log in to the Cloudflare Dashboard at
dash.cloudflare.com - Select your domain from the list
- Click DNS in the left sidebar, then Records
- Click the + Add record button
- Fill in the fields:
Type TXTName _dmarcContent v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.comTTL Auto(recommended) - Click Save
Cloudflare automatically appends your domain to the record name. Enter just
_dmarc, not _dmarc.yourdomain.com. Cloudflare shows the full name in the record list after saving.
Step 2: Add or Update Your SPF Record
SPF goes on the root domain (the @ record). You should only have one SPF record — if one already exists, edit it rather than creating a second one.
- Check for an existing SPF record: Look through your TXT records for one starting with
v=spf1 - If one exists, click Edit and modify the content. If not, click + Add record
- Fill in the fields:
Type TXTName @Content v=spf1 include:_spf.google.com ~allTTL Auto - Click Save
Never create multiple SPF records for the same domain. If you have multiple email services (e.g., Google Workspace + Mailchimp), combine them into one record:
v=spf1 include:_spf.google.com include:servers.mcsv.net ~all. See SPF Record Syntax for details.
Step 3: Add DKIM Records
DKIM records are provided by your email service. For example, Google Workspace gives you a TXT record to add. The process in Cloudflare is the same:
- Get the DKIM record details from your email provider (name and value)
- In Cloudflare DNS, click + Add record
- Fill in the fields:
Type TXTName google._domainkey(example for Google)Content The DKIM value from your email provider TTL Auto - Click Save
Cloudflare-Specific Tips
TXT records don’t have a proxy toggle (orange/grey cloud). This only applies to A and CNAME records. Your email security records will work immediately.
Cloudflare DNS changes usually go live within seconds. You can verify your records almost immediately after adding them.
Don’t add quotation marks around the TXT value. Cloudflare handles this automatically. Just paste the raw record value.
If your DKIM record is very long (2048-bit keys), Cloudflare will handle it correctly. Some providers require splitting, but Cloudflare does not — paste the full value.
Verify Your Records
After adding your records, verify they’re working correctly:
- Use the Domain Checker to verify all records are published
- Check that your DMARC record starts with
v=DMARC1 - Confirm you have only one SPF record starting with
v=spf1 - Send a test email and check the headers for SPF/DKIM/DMARC pass results
What’s Next?
- Read DMARC Record Explained to understand each tag in your record
- Learn about DMARC policies and when to move beyond
p=none - Follow the p=none to p=reject journey for a safe enforcement path
- Check your domain regularly with the Domain Checker