SPF, DKIM and DMARC
Multiple SPF Records: Why Two Records Break SPF and How to Merge Them
A domain can have only one SPF record. Publish two and receivers return permerror, so SPF fails for all your mail. Here's how to merge them into one record.
On this page
A domain can have only one SPF record. If DNS returns two TXT records that start with v=spf1 for the same name, receivers don't pick one: the SPF spec says the result is a permanent error (permerror), and SPF fails. The fix is to merge everything into a single record with one v=spf1 at the start and one all at the end.
This one is easy to cause and easy to miss. Every sending service's setup guide says "add this SPF record," and if you follow two of them literally, you end up with two records. Nothing bounces right away, and the problem can sit there until DMARC enforcement or a provider's sender requirements make SPF matter.
What the spec says
RFC 7208, the SPF specification, is direct about it. Section 3.2: "A domain name MUST NOT have multiple records that would cause an authorization check to select more than one record." And section 4.5: "If the resultant record set includes more than one record, check_host() produces the 'permerror' result."
Microsoft's documentation says the same in plainer terms: multiple SPF TXT records for the same domain or subdomain "cause SPF to return permerror (the receiving system can't determine which record to evaluate)." Google's says "Each domain can have one SPF record, but the record can specify additional servers and third parties."
Permerror counts as an SPF failure for DMARC. If your DKIM is aligned, DMARC can still pass, but you've lost one of your two supports.
What counts as a duplicate (and what doesn't)
Only TXT records that start with v=spf1 count. These are fine together on the same name:
example.com. TXT "v=spf1 include:_spf.google.com ~all"
example.com. TXT "google-site-verification=abc123"
example.com. TXT "MS=ms12345678"
RFC 7208 discards any record that doesn't start with exactly v=spf1, so verification tokens and other TXT records don't interfere.
This is a duplicate:
example.com. TXT "v=spf1 include:_spf.google.com ~all"
example.com. TXT "v=spf1 include:spf.esp.example -all"
Two other situations look like duplicates but aren't:
- Records on different hostnames.
example.comandnews.example.comeach get their own SPF record. That's correct, and it's a good way to keep each domain under the 10-lookup limit. - One record split into several strings. A single TXT record can hold more than one quoted string, which DNS needs for anything over 255 characters. RFC 7208 says those strings are joined "without adding spaces," so
"v=spf1 include:_spf.google.com " "include:spf.esp.example -all"is one record. Mind the space at the end of the first string.
How to merge two SPF records
- Find every SPF record. Run
dig +short TXT example.comor use the SPF, DKIM and DMARC checker, which flags duplicates. Copy eachv=spf1record somewhere you can edit. - List the mechanisms. Pull out every
include:,ip4:,ip6:,aandmxterm from all the records. Drop exact duplicates. - Remove anything you no longer use. A merge is a good moment to retire the include for the platform you left two years ago.
- Pick one
all. Each record ends with its ownallqualifier, and you can only keep one. Use-all(fail) if you're confident every legitimate source is listed, or~all(softfail) if you're not. The SPF record guide covers the difference. - Build the merged record. One
v=spf1at the start, the mechanisms in the middle,alllast. Anything afterallis ignored. - Count lookups. Merging adds up the DNS lookups from every include. Run the result through the SPF lookup counter before you publish. Two records that were each under 10 can be over 10 together, which trades one permerror for another.
- Publish the merged record and delete the old ones. Edit one of the existing records into the merged version and delete the other, rather than adding a third.
Using the duplicate example above, the merged record is:
example.com. TXT "v=spf1 include:_spf.google.com include:spf.esp.example ~all"
Common mistakes when merging
- Two
v=spf1tags in one record."v=spf1 include:a.example v=spf1 include:b.example ~all"isn't a merge. It's a syntax error. - Two
allterms. Evaluation stops at the firstall, so everything after it is ignored. Only one belongs, at the end. - A missing space between strings. When a long record is split, the strings are joined with no space added, so
"...include:a.example" "include:b.example..."becomesinclude:a.exampleinclude:b.example. - Using the old SPF record type. RFC 7208 says SPF records must be published as TXT. If your DNS console offers an "SPF" record type, don't use it.
How to confirm it's fixed
- Query DNS again and confirm exactly one
v=spf1record comes back. Changes can take time to appear depending on your TTL. - Re-run the checker and lookup counter.
- Send a test message from each service in the record to a mailbox you control and check for
spf=passin theAuthentication-Resultsheader. The header analyzer makes this quick. - If you have DMARC, watch your aggregate reports over the next few days. SPF results should go from failing across every source to passing.
How to keep it from coming back
Duplicates come from onboarding a new tool by following its setup guide literally. Two habits help:
- Whoever owns DNS edits the existing SPF record rather than adding one. Make that the rule for every new sending service.
- Keep a short note of which include belongs to which vendor and who owns it, so the next merge (or cleanup) is quick.
If SPF fails across every source at once, a duplicate record or a lookup-limit permerror is the most likely cause. SPF fail, softfail, permerror and temperror explains each result, and DMARC fail covers what happens downstream.
When to get help
If you're not sure which includes are still in use, or a merged record keeps coming out over 10 lookups, a quick review of the record is cheaper than breaking SPF for the whole domain.
FAQ
What happens if I have two SPF records?
Receivers return permerror, which is an SPF failure. Any mail that relies on SPF for DMARC fails DMARC too. Merge them into one.
Can I have an SPF record on my domain and another on a subdomain?
Yes. Each hostname gets its own record. Only two v=spf1 records on the same name are a problem.
Do other TXT records count as SPF records?
No. Only TXT records starting with v=spf1 are SPF records. Domain verification tokens and other TXT records can sit alongside it.
Should the merged record end in -all or ~all?
Use -all if you're confident every legitimate source is in the record, and ~all if you're still finding them. Under DMARC, the difference matters less than getting SPF and DKIM aligned.
Sources
Related guides
- Authenticating Every Tool That Sends as Your Domain (Sender Inventory)List every service that sends mail as your domain, then give each one SPF coverage and DKIM signing on your domain so all of them pass DMARC.
- DKIM Fail: Body Hash Did Not Verify, Signature Failed and Other CausesDKIM fails when the message changed after signing (body hash did not verify), the signed headers changed, or the receiver can't find a matching public key.
- DMARC Fail: Why DMARC Fails and How to Fix ItDMARC fails when neither SPF nor DKIM passes for a domain aligned with your From address. Usually a sender lacks custom DKIM. Here's how to find and fix it.
- DMARC Policy: p=none vs quarantine vs reject (and Getting to Enforcement)p=none only monitors, p=quarantine asks receivers to junk failing mail, p=reject asks them to refuse it. Start at none, fix your senders, then tighten.
- DMARC Record Syntax and Tags ExplainedA DMARC record is a TXT record at _dmarc.yourdomain with tags for policy, reporting and alignment. Here's what each tag does and what's changed under DMARCbis.
- DMARC Reports: How to Read Aggregate (rua) and Failure (ruf) ReportsDMARC aggregate reports are daily XML summaries of every IP sending as your domain and whether it passed. Here's how to read them and what to do with them.
Still stuck?
Some deliverability problems take an experienced eye to untangle. Tell me what you're seeing and I'll tell you what I'd check first. The first 30-minute call is free.