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.
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
Related guides
Frequently asked questions
Do I need DMARC if I already have SPF and DKIM?
Can DMARC pass if SPF fails?
What does DMARC alignment mean?
Related tools
Subnet Calculator
Calculate network address, broadcast address, and usable IP ranges for IPv4/IPv6.
Use toolText Encoding Converter
Convert text to Base64, binary, hex, URL encoding and HTML entities, and back again.
Use toolJWT Decoder & Validator
Decode JWT headers and claims, check exp, nbf and iat, and verify signatures locally with your own key.
Use tool