SPF vs DKIM: What Each One Does and Why Your Business Needs Both

SPF vs DKIM. Two acronyms that always appear together, usually explained in ways that make them sound like the same thing with different spellings.

Several pairs of pliers and cutters stored upright in a wooden holder.

They're not. They answer completely different questions.

Here's the simplest way to hold them in your head:

  • SPF checks the route: was the server that delivered this allowed to send for this domain?
  • DKIM checks the message: does this email carry a valid signature from this domain, and has it been tampered with?

Once you see that, a lot of confusing situations make sense. Why forwarding breaks SPF but not DKIM. Why a footer added by a gateway breaks DKIM but not SPF. Why both can pass and DMARC still fails.

This guide lays both checks side by side in plain English, shows how each one fails, and explains how DMARC turns them into real protection for your domain.

Two Different Questions, Two Different Checks

SPF: "Is this server on the guest list?"

SPF (Sender Policy Framework) asks whether the server that connected is authorised to use a domain in the SMTP conversation, normally the envelope (MAIL FROM) domain.

The receiver looks up that domain's SPF record and checks whether the connecting IP is allowed. RFC 7208 defines SPF as host authorisation for the MAIL FROM and HELO identities.

What SPF doesn't do:

  • It doesn't sign the message
  • It doesn't normally check the From address your reader sees

DKIM: "Is this signature genuine, and is the seal intact?"

DKIM (DomainKeys Identified Mail) puts a cryptographic signature inside the message. The receiver fetches a public key using the signature's selector and signing domain, then checks the signed headers and a fingerprint of the body. RFC 6376 defines this.

What DKIM doesn't do:

  • It doesn't encrypt the email
  • On its own, it doesn't prove the visible From address

An Analogy That Makes It Stick

Imagine a parcel delivered to your door.

SPF is like checking the courier against an approved list. "Is this van from a company the sender authorised to deliver for them?" It says nothing about what's inside the box.

DKIM is like a tamper-evident seal on the box, stamped with the sender's mark. "Was this sealed by who it says, and has anyone opened it?" It doesn't care which van brought it.

DMARC is the final question: "Does either the approved courier or the seal actually belong to the company named on the label?"

SPF Follows the Delivery Route

An SPF check needs two facts from the delivery itself:

  • The connecting IP
  • The MAIL FROM identity

Both belong to the SMTP session, not the message content.

That's why forwarding breaks SPF. A forwarded message arrives from the forwarder's IP, which isn't on your list, even though the content hasn't changed at all.

What an SPF record looks like

v=spf1 include:mailprovider.example include:newsletter.example -all

Key rules from RFC 7208:

  • One SPF record per name. Two records cause a permanent error.
  • Mechanisms like ip4, ip6, a, mx and include
  • No more than ten DNS-querying terms per evaluation

That's why broad copy-and-paste edits are risky. A second record breaks everything. Another nested include can push you over the limit. Removing an unfamiliar include can break a sender you forgot about.

Always look up the exact envelope domain from a real email before changing anything. See how to fix an SPF record.

DKIM Follows the Message Itself

A DKIM signature names:

  • The signing domain (d=)
  • The selector (s=)

The receiver combines them into a DNS name like selector._domainkey.yourbusiness.co.uk to find the public key.

The private key stays with the signer. It must never go in DNS, a support ticket or an email.

What a DKIM signature looks like

DKIM-Signature: v=1; a=rsa-sha256; d=yourbusiness.co.uk; s=mail2026;
    h=from:to:subject:date; bh=...; b=...

DKIM can tolerate some small formatting differences (through "canonicalisation"), but verification still depends on the signed headers and body matching what was signed. RFC 6376 explains this.

So a footer added after signing, a gateway that rewrites links or a mangled message structure can break a signature that was valid when it left.

And a DKIM pass only proves the signature verified for the named domain. It doesn't confirm that domain matches your From address, that the content is safe or that the person sending is genuine.

Side by Side: SPF vs DKIM

                        SPF                              DKIM
What it checks          The sending server's IP          A cryptographic signature
                        against a domain's allowed list  in the message
Which domain            Envelope sender (MAIL FROM),     Signing domain (d=)
                        sometimes HELO
Where it's published    TXT record at the domain         TXT (or CNAME) at
                                                         selector._domainkey.domain
Survives forwarding?    Usually not                      Usually yes, if content
                                                         is unchanged
Survives content        Yes                              Often not
changes (footers etc)?
Common failure          Unlisted server, two records,    Missing key, wrong selector,
                        too many lookups                 signing not enabled,
                                                         message modified
Checks visible From?    No                               No (DMARC does that)

Where DMARC Comes In

DMARC uses the SPF-validated MAIL FROM domain and the DKIM d= domain as its two candidate identities. It passes when at least one of them both passes and aligns with the visible From domain. RFC 9989 defines this "OR" rule.

Requiring both SPF and DKIM to align isn't the DMARC rule. One is enough.

Two examples:

  • A campaign shows news@yourbusiness.co.uk. SPF passes for bounce.vendor.net. DKIM passes for yourbusiness.co.uk. DMARC passes, through DKIM.
  • Another route uses return.yourbusiness.co.uk for SPF and has no useful DKIM signature. Relaxed SPF alignment carries it.

That's why a dashboard saying "SPF pass" isn't enough. Always record which domain passed.

The DMARC alignment guide explains the comparison in detail.

Do You Need Both? Yes, and Here's the Practical Reason

DMARC only needs one aligned pass. So why bother with both?

Because each covers the other's weakness:

  • Forwarding breaks SPF but usually not DKIM
  • Content changes break DKIM but not SPF

With both aligned, a receiver has two routes to a DMARC pass. Lose one in a particular situation, and the other often carries you.

Google also requires both SPF and DKIM for bulk senders to personal Gmail accounts, and SPF or DKIM for all senders. Its sender guidelines set this out, and also tell people using service providers to check their domain mail is actually authenticated.

The trade-off: every authorised sender, SPF dependency, selector and key needs an owner. Don't add mechanisms just to collect green ticks. A bloated SPF record is fragile. An old DKIM key left live after a supplier closes is unnecessary authority.

Real-World Scenarios: Which Check Breaks?

Seeing how each check behaves in everyday situations makes the difference stick.

A customer auto-forwards your email to their personal account

  • SPF: usually fails at the final destination (the forwarder's IP isn't on your list)
  • DKIM: usually survives, if the forwarder didn't change the message
  • DMARC: passes if your DKIM is aligned

A company's security gateway adds a warning banner to your email

  • SPF: may pass at the gateway itself
  • DKIM: may break, because the body changed after signing
  • DMARC: depends on whether aligned SPF still applies at the point of checking

A newsletter platform sends with its own envelope domain and its own signature

  • SPF: passes, but for the platform's domain
  • DKIM: passes, but for the platform's domain
  • DMARC: fails, because neither aligns with your From address
  • SPF: fails (the list's servers aren't authorised for your domain)
  • DKIM: often fails (signed subject and body changed)
  • DMARC: usually fails, unless the list rewrites the From address or the receiver trusts an ARC chain

See why forwarding and mailing lists break authentication for more.

Setting Up SPF and DKIM: The Order That Works

For a small business starting from scratch, this order avoids most problems:

  1. List every service that sends as your domain (the sender inventory template helps)
  2. For each service, find out which envelope domain it uses and whether it supports custom DKIM
  3. Build one SPF record covering the services that use your domain as the envelope sender
  4. Enable custom DKIM in each service, publishing each selector it gives you
  5. Send a test from each service and check the headers
  6. Publish DMARC at p=none with reporting
  7. Fix anything that doesn't align, then move DMARC towards enforcement

Notice DKIM gets set up per service, while SPF is usually one shared record. That's another reason DKIM scales better as you add tools.

Match the Fix to the Check That Actually Failed

SPF problems

  • SPF none: look up the exact MAIL FROM domain. Should a policy exist there?
  • SPF permerror: check for two records, syntax errors and lookup counts
  • SPF fails only after forwarding: don't authorise the forwarder blindly. Check whether aligned DKIM survives.

DKIM problems

  • DKIM missing: does the platform offer domain authentication? Is signing switched on for this route?
  • DKIM failing: use the actual d= and s= from the email to look up the exact key. Separate a missing key from a body hash or signature failure. Don't rotate unrelated selectors.

Both pass, DMARC fails

That's alignment. Changing SPF syntax can't align an unrelated DKIM domain. Publishing a DKIM key can't change a provider-controlled envelope domain. Give the problem to whoever owns the identity that needs changing.

The DKIM selector troubleshooting guide covers DKIM failures in depth.

Collect a Four-Identity Evidence Row

For each route and message type, record:

  1. Visible identity: the domain after @ in the From address
  2. Route identity: the MAIL FROM domain (from Return-Path or trusted receiver evidence), plus the connecting source if available
  3. Signing identity: every DKIM d= domain and s= selector
  4. Receiver verdicts: SPF, DKIM and DMARC results, reason text, UTC time and receiving service

A marketing platform, website form and staff mailbox might all show the same From domain while producing completely different rows.

Keep Signing Secrets Out of Your Evidence

SPF investigations need the connecting source, MAIL FROM domain, result and the policy retrieved. DKIM investigations need the d= domain, s= selector, result and public key answer.

Keep full headers in a restricted folder. Remove names, personal addresses and subjects from working copies.

SPF include chains and DKIM public keys are public DNS data. A complete header isn't, because it can reveal recipients and internal relays. And a DKIM private key is never diagnostic evidence. If anyone asks for one, refuse.

Test SPF and DKIM as Two Different Mechanisms

Send one authorised message through the route to a receiver you control.

  • For SPF: capture the Return-Path, connecting source and SPF verdict
  • For DKIM: capture every signing domain and selector, and which signature verified
  • Then compare each passing domain with the From domain for DMARC

If aligned DKIM is meant to survive forwarding, check it on a forwarded copy too. If aligned SPF is the intended path, confirm the real envelope domain rather than assuming.

After any shared SPF or selector change, re-test a separate known-good sender.

When to Stop

Don't edit SPF because DKIM is unaligned, and don't publish a DKIM key to fix an SPF route problem.

Stop if:

  • You haven't seen the MAIL FROM domain in a real email
  • The selector in the signature differs from the provider's instructions
  • The SPF record can't be expanded within its limits
  • A selector name is already taken
  • A second SPF record would be created

Never add unrelated IPs, delete unexplained includes, overwrite active selectors or hand a private key to support.

Common Myths About SPF and DKIM

Myth: "SPF protects my From address." It doesn't. SPF checks the envelope sender. Only DMARC ties authentication to the visible From domain.

Myth: "DKIM encrypts my emails." It doesn't. DKIM signs them. Anyone can read a DKIM-signed email; the signature just proves who signed it and that it wasn't changed.

Myth: "If I have SPF, I don't need DKIM." DMARC only needs one aligned pass, but SPF breaks on forwarding. Without DKIM, forwarded copies of your email can fail DMARC.

Myth: "More includes in SPF means more protection." The opposite. Every include authorises another service to send as you, and too many cause a permanent error.

How to Check Your Own SPF and DKIM in Two Minutes

  1. Send an email from the system you want to check to a personal Gmail account
  2. Open it, click the three dots and choose "Show original"
  3. Look at the summary at the top: SPF, DKIM and DMARC, each with PASS or FAIL
  4. Scroll down to Authentication-Results and note which domain each passed for
  5. Compare those domains with the From address

If SPF and DKIM pass but for a different domain, you've found an alignment issue. If either fails, note the reason text. The free email checks guide goes further.

The Takeaway

SPF checks the route. DKIM checks the message. DMARC checks whether either of them actually belongs to the name your customer sees. SPF breaks on forwarding; DKIM breaks on content changes. Set up both, make sure at least one aligns on every route (ideally both), and always record which domain passed, not just whether something passed.

Frequently Asked Questions

What's the main difference between SPF and DKIM?

SPF checks whether the sending server is authorised for the envelope domain. DKIM checks a signature inside the message and whether its signed content is intact.

Do I need both SPF and DKIM?

DMARC only needs one aligned pass, but both give you resilience, and Google requires both for bulk senders to personal Gmail.

Which is more important for DMARC?

Aligned DKIM is often more reliable because it usually survives forwarding. But keeping both healthy is best.

Can SPF and DKIM both pass and DMARC still fail?

Yes. If neither passing domain aligns with your From domain, DMARC fails.

Where do I find my SPF and DKIM records?

In your domain's DNS. SPF is a TXT record at the domain used as the envelope sender. DKIM records live at selector._domainkey.yourdomain, with one selector per sending service.

Can one email have multiple DKIM signatures?

Yes. A provider might add its own signature alongside yours. DMARC passes if any valid signature aligns with your From domain.

Sources and further reading