How to add an SPF record in Cloudflare
SPF tells receiving servers which services may send email for your domain. If your DNS is hosted at Cloudflare, the record lives in the Cloudflare DNS dashboard. This guide shows how to add it and check it.
Before you start
- List every service that sends mail as your domain: your mailbox provider, newsletter tool, CRM, helpdesk.
- Get each service’s SPF
include:value from its documentation. - Check whether your domain already has an SPF record. A domain must have only one. If you find one, edit it instead of adding a second. See SPF, DKIM and DMARC explained for the background.
Add the record
-
Log in to the Cloudflare dashboard and select your domain.
-
Open DNS and then Records.
-
Click Add record.
-
Set Type to
TXT. -
Set Name to
@(this means the root domain). -
Paste your SPF value into Content, for example:
v=spf1 include:_spf.google.com include:sendgrid.net ~all -
Leave TTL on Auto and click Save.
Cloudflare’s proxy (orange cloud) does not apply to TXT records, so there is nothing to toggle.
Editing an existing record
If a record starting with v=spf1 already exists, click Edit on it and add the new include: mechanism before
the final ~all or -all. Never create a second SPF record, because receivers treat two records as a permanent error.
Verify
Changes on Cloudflare usually appear within minutes. Check with:
dig +short TXT example.com
Look for the line starting with v=spf1. You can also send a test message and read the
Authentication-Results header, as described in how to read email headers.
Common mistakes
- Two SPF records. Merge them into one.
- More than 10 DNS lookups. Every
include:can cost several lookups. Remove services you no longer use. - Quotes pasted into the value. Cloudflare adds the quotes itself, so paste the value without them.
- Ending with
+all. This allows anyone to send as you. Use~allor-all.