SPF vs DKIM vs DMARC: what each one checks and why you need all three

By TechCompare · Updated · How we check

SPF and DKIM each prove something about a message, but neither looks at the From address people see. DMARC does, so it's the one that stops someone from spoofing your domain.

SPF, DKIM and DMARC are three TXT records that help a receiving mail server decide whether a message really came from your domain. SPF lists the servers allowed to send. DKIM adds a signature that proves the message wasn't changed. DMARC checks that one of them passed for the domain in the From address, then tells the receiver what to do when neither did.

Topic
SPF vs DKIM vs DMARC
Email authentication
Category
Email records
SPF, DKIM and DMARC

How this is calculated

SPF (RFC 7208) works on the envelope sender, the hidden return address you see as Return-Path in the headers. The receiver looks up the SPF record of that domain and checks whether the connecting server's IP address is on the list. It breaks when mail is forwarded, since the forwarding server isn't on your list.

DKIM (RFC 6376) signs the message. Your mail server adds a DKIM-Signature header made with a private key, and the receiver fetches the public key from DNS, using the selector and domain named in that header. The signature survives forwarding as long as nobody edits the signed headers or the body.

DMARC (RFC 9989) closes the gap both leave. It passes only when SPF or DKIM passes for a domain that matches the From address, which DMARC calls alignment. Its p= tag asks receivers to do nothing (none), send failures to spam (quarantine) or turn them away (reject). Its rua= tag asks for daily reports on who sends mail as you.

Gmail has required SPF or DKIM from every sender since February 2024. Senders who send more than 5,000 messages a day to Gmail accounts need all three, though their DMARC policy can stay at p=none.

The DNS Lookup reads all three. SPF and DMARC show up as soon as you look a domain up, and DKIM needs the selector from one of the domain's messages.

Verdict

Set up all three, in this order. Publish SPF with every service that sends for you, turn on DKIM signing at each of those services, then add DMARC with p=none and a rua address. Read the reports for a few weeks, fix any real sender that fails, then move to quarantine and later to reject.

More DNS scenarios

TXT records
The free text record that holds verification codes, SPF, DKIM keys and DMARC policies.
View details
MX records
How senders find your mail servers, what the priority number does, and the null MX for domains that take no mail.
View details
CNAME vs A record
An A record points a name at an address. A CNAME points it at another name, with rules that trip people up.
View details

Frequently asked questions

Do I need DMARC if I already have SPF and DKIM?
Yes, if you want to stop spoofing. SPF checks the hidden envelope sender and DKIM checks whichever domain signed, so a scammer can pass both with their own domain and still put yours in the From line. DMARC is the only one of the three that ties a pass to the From address.
Can DMARC pass if SPF fails?
Yes. DMARC needs only one aligned pass. Forwarded mail often fails SPF because the forwarding server isn't on your list, but the DKIM signature still holds, so DMARC passes on DKIM.
What does DMARC alignment mean?
The domain that passed SPF or DKIM has to match the From address. Relaxed alignment, the default, accepts a subdomain of the same main domain, so mail.example.com aligns with example.com. Strict alignment, set with aspf=s or adkim=s, needs an exact match.