Skip to content

DMARC vs SPF vs DKIM: What Each One Does

SPF, DKIM and DMARC solve different parts of email authentication. Here is what each checks, what it misses and why you need all three.

Published 8 min read

SPF, DKIM and DMARC are three separate DNS-based checks that work as a stack. SPF says which servers may send mail for a domain, DKIM proves a message was signed by a domain and not altered, and DMARC ties either result to the visible From address and tells receivers what to do when that link is missing. You need all three: SPF and DKIM authenticate, and only DMARC protects the address people actually read.

The short answer

Each protocol answers a different question about a message:

  • SPF: Was this message sent from an IP address the envelope sender's domain allows?
  • DKIM: Was this message signed by the domain in the signature, and is it unchanged since?
  • DMARC: Does the domain that passed SPF or DKIM match the domain in the From: header, and if not, what does the owner of that domain want done?

SPF and DKIM were designed before DMARC. Neither one looks at the From: header, which is why a phishing message can pass both and still pretend to be your company. DMARC was added on top to close that gap.

SPF vs DKIM vs DMARC comparison

SPF DKIM DMARC
Specification RFC 7208 RFC 6376 RFC 9989 (obsoletes RFC 7489)
What it checks Sending IP against an allow list Cryptographic signature over headers and body Alignment of SPF or DKIM with the From domain
Domain it authenticates MAIL FROM (Return-Path) domain d= domain in the signature From: header domain
DNS record location TXT at example.com TXT at selector._domainkey.example.com TXT at _dmarc.example.com
Visible to the reader? No No Yes, it protects the From address
Survives forwarding? Usually not Usually, if the message is not modified Depends on SPF or DKIM surviving
Sets a policy for failures? Weakly (~all, -all) No Yes (none, quarantine, reject)
Sends reports? No No Yes, aggregate and failure reports
Can you publish only one? Yes, but it does not stop From spoofing Yes, but it does not stop From spoofing No, it needs SPF or DKIM to pass

What SPF does

SPF (Sender Policy Framework) lets a domain list the servers allowed to use it as the envelope sender. During the SMTP conversation the sending server announces a MAIL FROM address. The receiver looks up the SPF record of that address's domain and checks whether the connecting IP is on the list.

example.com.  3600  IN  TXT  "v=spf1 include:_spf.google.com include:sendgrid.net -all"

This record authorizes Google Workspace and SendGrid, and asks receivers to fail everything else.

What SPF misses

  • The From header. SPF checks the MAIL FROM domain, which ends up in the Return-Path header. An attacker can pass SPF for attacker.example.net while the From line says ceo@example.com.
  • Forwarded mail. When a message is forwarded, the forwarding server connects from its own IP. Your SPF record does not list it, so SPF fails or returns no result for your domain.
  • Complex setups. SPF allows at most 10 DNS lookups. Each include: counts, and many organizations hit the limit and get a PermError. The SPF records guide covers the limit and how to fix it.

Test your record with the SPF checker.

What DKIM does

DKIM (DomainKeys Identified Mail) adds a digital signature to each message. The sending server signs selected headers and the body with a private key. The signature header names the signing domain (d=) and a selector (s=). The receiver fetches the public key from DNS at <selector>._domainkey.<domain> and verifies the signature.

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com; s=google;
  h=from:to:subject:date:message-id; bh=...; b=...
google._domainkey.example.com.  3600  IN  TXT  "v=DKIM1; k=rsa; p=MIIBIjANBgkqh..."

A passing signature proves two things: someone with the private key for example.com signed the message, and the signed parts have not changed.

What DKIM misses

  • Which domain signed. Any domain can sign any message. A valid signature from d=attacker.example.net on a message claiming From: ceo@example.com is a real pass, for the wrong domain.
  • Unsigned mail. DKIM has no policy. A message with no signature is simply "none". Nothing in DKIM tells the receiver that your domain always signs.
  • Modification. Mailing lists that add footers or change the subject break the body or header hash, and the signature fails.

Find and test your selectors with the DKIM checker. The DKIM guide explains selectors, key sizes and rotation.

What DMARC does

DMARC (Domain-based Message Authentication, Reporting, and Conformance) adds three things SPF and DKIM lack.

  1. Alignment. The domain that passed SPF or DKIM must match the From: domain. In relaxed mode they share an organizational domain; in strict mode they are identical. See DMARC alignment explained.
  2. Policy. The domain owner publishes what to do with mail that fails: p=none (monitor), p=quarantine (spam folder) or p=reject (refuse).
  3. Reporting. Receivers send daily aggregate reports to the rua address, listing every IP that sent mail as your domain and how it scored.
_dmarc.example.com.  3600  IN  TXT  "v=DMARC1; p=reject; rua=mailto:dmarc@example.com"

A message passes DMARC when at least one of SPF or DKIM passes and is aligned. Both are not required. The full mechanism is covered in what is DMARC.

What DMARC misses

  • Lookalike domains. examp1e.com or example-billing.com are different domains with their own (or no) DMARC records.
  • Display name tricks. "Example Support" <random@freemail.example> passes DMARC for the free mail domain.
  • Compromised accounts. Mail sent from a hijacked mailbox on your own system is fully authenticated.

The email spoofing guide covers these cases and what helps against each.

How the three work together: a worked example

Take one message and run it through all three checks. The sender is a marketing platform sending for example.com.

Return-Path: <bounce-8812@bounce.example.com>
DKIM-Signature: v=1; a=rsa-sha256; d=example.com; s=mkt1; ...
DKIM-Signature: v=1; a=rsa-sha256; d=platform.example; s=pf; ...
From: Example News <news@example.com>
Step Check Domain Result Aligned with example.com?
1 SPF bounce.example.com pass Yes (relaxed)
2 DKIM #1 example.com pass Yes
3 DKIM #2 platform.example pass No
4 DMARC example.com pass

Now forward the same message through a university alias that rewrites nothing but sends from its own servers:

Check Result after forwarding Why
SPF fail or softfail The forwarder's IP is not in the SPF record for bounce.example.com
DKIM #1 pass The signature travels with the message and the content is unchanged
DMARC pass DKIM still gives an aligned pass

This is the practical reason to deploy both SPF and DKIM. SPF covers mail sent without a signature, and DKIM carries the message through forwarding. The forwarding and ARC guide covers the cases where both break.

Finally, a spoofed copy from an attacker's server:

Check Result Domain Aligned?
SPF pass attacker.example.net No
DKIM none No
DMARC fail

Under p=reject the receiver refuses it. SPF alone would have reported a pass.

Do I need SPF, DKIM and DMARC?

Yes, for any domain that sends mail. Gmail and Yahoo require SPF and DKIM for bulk senders and a DMARC record with an aligned From domain; Gmail requires SPF or DKIM for all senders. The Google and Yahoo sender requirements have the details.

Can DMARC work without DKIM?

Yes. DMARC passes on aligned SPF alone. It is fragile, though, because forwarding breaks SPF. Without DKIM, forwarded mail fails DMARC, and under p=reject it can bounce.

Can DMARC work without SPF?

Yes. Aligned DKIM alone is enough to pass. Most domains still publish SPF because some systems send unsigned mail, because receivers use SPF as a reputation signal, and because the bulk sender rules ask for it.

Which one is the most important?

DMARC is the one that protects your From address, but it does nothing on its own. Treat DKIM as the main path to a DMARC pass and SPF as the backup.

Does a domain that sends no mail need all three?

It needs SPF and DMARC, and no DKIM key. Publish v=spf1 -all at the domain and v=DMARC1; p=reject; at _dmarc. The subdomains and parked domains guide has full examples.

Setup order

  1. Inventory senders. List every system that sends as your domain: mailbox provider, CRM, help desk, billing, newsletters.
  2. Publish SPF with all of them, staying under 10 lookups.
  3. Turn on DKIM at each sender with your own domain as d=. For third parties this is usually a pair of CNAME records. See authenticating third-party senders.
  4. Publish DMARC at p=none with a rua address. Build it with the DMARC generator.
  5. Read reports and fix every legitimate source that fails alignment.
  6. Enforce: move to p=quarantine, then p=reject. The setup guide walks through the timing.

Common mistakes

  • Treating spf=pass as proof of identity. It only says the IP is allowed for the envelope domain, which may not be yours.
  • Adding vendors to SPF but not to DKIM. Forwarded mail from those vendors will fail DMARC.
  • Leaving vendor DKIM on the vendor's domain. A signature with d=vendor.example passes DKIM and fails alignment.
  • Publishing two SPF records. Receivers return a PermError. Merge them into one.
  • Stopping at p=none. Monitoring shows the problem but protects nobody.

Key takeaways

  • SPF authorizes sending IPs for the envelope domain.
  • DKIM signs the message for the d= domain and detects tampering.
  • DMARC requires one of them to pass with a domain aligned to the From header, sets a policy and sends reports.
  • SPF breaks on forwarding; DKIM usually survives. Deploy both.
  • None of the three stops lookalike domains or compromised accounts.

Run a full domain scan to see your SPF, DKIM and DMARC records side by side, or start with the free DMARC checker.

Check your domain now