Multiple SPF records: why they break email and how to merge them

Why two SPF records make SPF fail for all your mail, and how to merge them into one.

Your domain has two (or more) TXT records that start with v=spf1. It usually happens when a new email service tells you to "add this SPF record" and you add it next to the one you already had.

That second record doesn't add the new service. It breaks SPF for every message you send, from every service. Receivers don't pick one or combine them: they treat the domain as having no valid SPF record at all.

The fix is to combine everything into one record. It takes a few minutes, and this guide walks through it.

Find out how many SPF records you have. Rigcheck lists every SPF record on your domain and, when there's more than one, gives you a single merged record to replace them.

Why two records break SPF

The SPF standard (RFC 7208) allows one SPF record per domain name. When a receiver looks up your domain's TXT records and finds more than one that starts with v=spf1, it stops and returns PermError, a permanent error meaning the record is published wrong. It doesn't fall back to the first record or try both.

A PermError isn't a pass, so DMARC can only pass through DKIM. Any service that sends without DKIM for your domain fails DMARC, and at p=quarantine or p=reject its mail goes to spam or bounces. Nothing warns you: mail from services with DKIM keeps arriving, so the problem can go unnoticed for months. Receivers that reject on SPF errors bounce the mail instead, with codes like 550 5.7.24 (550 5.7.23 and 5.7.24 explained).

What counts as a second SPF record, and what doesn't

What you see in DNSA problem?
Two TXT records at @ (your main domain), both starting v=spf1Yes: merge them
One TXT record at @ that your DNS host shows split into several quoted stringsNo: it's still one record
v=spf1 at @ and another at a subdomain, like mail or bouncesNo: each name has its own record
v=spf1 next to other TXT records, like google-site-verification=No: only records starting v=spf1 count
A record of type SPF (not TXT) left from an old setupNot a second record, but remove it: receivers ignore that type, so only the TXT record works

Find every SPF record on your domain

The quickest way is the Rigcheck checker: it lists each SPF record it finds. You can also look in your DNS host's list of records for TXT records at @ (sometimes shown as your bare domain name), or run one of these on a computer:

dig +short TXT yourdomain.com
nslookup -type=TXT yourdomain.com

Any line that starts with "v=spf1 is an SPF record. Here's a domain with two:

"v=spf1 include:_spf.google.com ~all"
"v=spf1 include:sendgrid.net -all"

How to combine them into one record

Step 1: Collect every part from every record

Write down everything between v=spf1 and the all at the end of each record: the include:, ip4:, ip6:, a and mx parts. List each one once, even if it appears in both records. From the example above, that's include:_spf.google.com and include:sendgrid.net.

Step 2: Pick one ending

The merged record ends with a single all. Use ~all (soft fail) unless you're sure every service that sends as your domain is in the record, in which case -all (hard fail) is fine. If either old record ended in -all, someone chose that on purpose, so check with them first. Never use +all: it lets any server in the world send as you.

Step 3: Write the merged record

Start with v=spf1, add the parts with a space between each, and finish with the ending. For the example:

Host@
TypeTXT
Valuev=spf1 include:_spf.google.com include:sendgrid.net ~all

Use your own parts; the ones above are only an example. If one of the old records used redirect=, replace it with an include: of the same domain in the merged record.

Step 4: Count the lookups

Merging adds the lookups from both records together, and the limit is 10 for the whole record, nested includes counted. A merged record over 10 still fails with PermError. The Rigcheck checker counts them for you; if you're over, SPF too many DNS lookups shows how to get back under.

Step 5: Replace the old records

Edit one of the existing SPF records so it holds the merged value, then delete the others. Editing in place, instead of adding a new record first, means there's never a moment with three.

After you change the record

  1. Wait a few minutes, then run your domain through the Rigcheck checker: it should show one SPF record that passes. If it still shows two, the old one may still be cached; DNS changes not showing up explains how long that takes.
  2. Send a test from each service that sends for you and check the headers for spf=pass.
  3. When you add a new email service later, add its include: to this record instead of creating a new one.

Questions people ask

Some receivers seem to accept my mail anyway. Is it really broken?

Yes. Mail that arrives is usually getting through on DKIM, not SPF. Don't count on any receiver being lenient: the standard says two records is an error.

My new service gave me a whole SPF record, not an include. What do I add?

Take the parts between v=spf1 and all from the record it gave you (usually one include:) and add them to your existing record. The service's setup check may look for the include, not the whole record.

Can I put a second SPF record on a subdomain instead?

Yes, if the service sends from that subdomain. Each name gets its own single record, so news.yourdomain.com can have its own SPF record without touching the one at @.

Check your SPF record now. Rigcheck finds duplicate records, counts your lookups and gives you the exact record to use.

Check my setup

Browse all guides