SPF, DKIM and DMARC are three DNS-based email authentication standards that work together to stop spoofing. SPF lists the servers allowed to send mail for your domain, DKIM adds a cryptographic signature proving the message was not altered, and DMARC checks that one of them matches the visible From address and tells receivers to deliver, quarantine or reject mail that fails.
Key takeaways
- SPF authorizes sending servers, DKIM signs messages, and DMARC ties both to the From address you actually see.
- A message passes DMARC when either SPF or DKIM passes for a domain aligned with the From domain — both do not need to pass.
- Set up SPF and DKIM first, then roll DMARC out slowly from p=none to p=quarantine to p=reject.
Anyone can send an email that claims to be from your domain. Email was never designed to prove who sent a message, which is why spoofed invoices, fake CEO requests and phishing emails look so convincing. SPF, DKIM and DMARC are the three standards that close that gap.
What are SPF, DKIM and DMARC?
SPF, DKIM and DMARC are three DNS-based standards that let receiving mail servers verify that an email really came from the domain in the From address. SPF authorizes sending servers, DKIM cryptographically signs messages, and DMARC ties both results to the visible From address and sets the policy for failures.
Think of them as three parts of one ID check. SPF is the guest list at the door: it says which servers are allowed to send mail for your domain. DKIM is a wax seal on the envelope: it proves nobody opened or changed the message on the way. DMARC is the instruction sheet: it tells the receiver what to do when the guest list or the seal does not check out, and asks for a report about it.
None of the three works alone. SPF does not look at the From address your reader sees. DKIM proves a message was signed, but says nothing about what to do if it was not. DMARC cannot authenticate anything by itself — it only interprets the SPF and DKIM results. Together they form the email authentication system that Gmail, Outlook and Yahoo now expect from every serious sender.
What is SPF and how does it work?
SPF (Sender Policy Framework) is a DNS record that lists the mail servers allowed to send email for your domain. When a message arrives, the receiving server looks up your SPF record and checks whether the sending server's IP address is on the list.
SPF is defined in RFC 7208, published in 2014. The record is a TXT record in your DNS, and it always starts with v=spf1. A typical record for a domain that only sends through Google Workspace looks like this: v=spf1 include:_spf.google.com ~all. Google's own setup guide uses exactly this example.
Each part of the record has a job. The include: mechanism pulls in another domain's SPF record, which is how you authorize a provider such as Google, Microsoft or Mailchimp without listing every server yourself. The ip4: and ip6: mechanisms list individual servers by address. The final all mechanism is the default rule, and its qualifier matters: ~all is a soft fail, which asks receivers to treat unauthorized mail as suspicious, while -all is a hard fail. Google recommends ~all in its setup guide.
Two SPF limits catch people out. First, a record may contain at most 10 DNS lookups — the include: mechanisms and a few others each count toward that limit, and exceeding it produces a permanent error. Second, SPF checks the envelope sender (the Return-Path address), not the From address shown to the reader. That gap is exactly what DMARC exists to close.
What is DKIM and how does it work?
DKIM (DomainKeys Identified Mail) adds a cryptographic signature to every outgoing email. The receiving server verifies the signature against a public key published in your DNS, which proves the message came from your domain and was not altered in transit.
DKIM is defined in RFC 6376, published in 2011. When your mail server sends a message, it hashes selected headers and the body, signs the hash with a private key that only you hold, and adds the result as a DKIM-Signature header. The header names the signing domain (d=) and a selector (s=), which tells the receiver where to find the public key in DNS.
The public key lives in a TXT record under a name like s1._domainkey.example.com, where s1 is the selector. The receiver fetches that key, recomputes the hash of the message it received, and compares it with the signed hash. If they match, the message is intact and was signed by your domain. If any signed part changed — even a single character — verification fails.
Selectors are useful because they let you use different keys for different senders or rotate keys safely: publish a new key under a new selector, switch your mail server to it, and remove the old key later. Most providers now use 2048-bit RSA keys; older 1024-bit keys still work but are weaker. A message can carry more than one DKIM signature, for example one from your mail provider and one from a marketing platform.
What is DMARC and how does it work?
DMARC (Domain-based Message Authentication, Reporting, and Conformance) is the policy layer that sits on top of SPF and DKIM. It checks whether either one passed for a domain that matches the visible From address, and tells receivers what to do when neither did.
DMARC is defined in RFC 7489, published in 2015, and the IETF published an updated DMARC specification, RFC 9989, in 2026. You publish a DMARC record as a TXT record at _dmarc.example.com. A starter record looks like this: v=DMARC1; p=none; rua=mailto:[email protected]. The p= tag sets the policy, and rua= sets the address that receives aggregate reports.
The key idea in DMARC is alignment. SPF checks the envelope sender and DKIM checks the signing domain, but neither of those is necessarily the domain your reader sees. DMARC compares the passing domain with the From domain. If SPF passes for example.com and the From address is also example.com, the message passes DMARC. If SPF passes only for a third-party domain, the message fails DMARC even though SPF itself passed.
Alignment can be relaxed or strict. With relaxed alignment, which is the default, a subdomain such as mail.example.com aligns with example.com. With strict alignment (aspf=s; adkim=s), the domains must match exactly. Strict alignment is safer but breaks more legitimate mail, so most organizations start relaxed.
How do SPF, DKIM and DMARC work together?
When a message arrives, the receiving server runs the checks in order: SPF first, then DKIM, then DMARC. DMARC passes the message if either SPF or DKIM passes for a domain aligned with the From address. If neither does, the DMARC policy decides what happens next.
Here is a concrete example. Your company sends an invoice from [email protected] through Google Workspace. The receiving server checks SPF: the sending server is in Google's SPF record, so SPF passes for example.com. It checks DKIM: Google signed the message with your domain's key, so DKIM passes too. DMARC sees both passes align with the From domain and delivers the mail.
Now an attacker sends the same invoice from their own server, also claiming to be from [email protected]. SPF fails because their server is not on your list. DKIM fails because they do not hold your private key. DMARC finds no aligned pass and applies your policy — at p=reject, the fake invoice never reaches the inbox.
Receivers record all three results in the Authentication-Results header of every message. If you open a message in Gmail and choose "Show original", you can read that header directly and see which check passed or failed. Our free email header analyzer does the same thing without the raw header hunting.
SPF vs DKIM vs DMARC: what is the difference?
SPF, DKIM and DMARC check different things, use different DNS records and fail in different ways. The table below is the comparison most administrators keep open while troubleshooting.
| SPF | DKIM | DMARC | |
|---|---|---|---|
| Full name | Sender Policy Framework | DomainKeys Identified Mail | Domain-based Message Authentication, Reporting, and Conformance |
| What it checks | The sending server's IP address | The message signature and content | Whether SPF or DKIM aligns with the From domain |
| What it proves | The server may send for this domain | The message was signed and not altered | The visible sender is authenticated |
| DNS record | TXT at the domain root | TXT at selector._domainkey | TXT at _dmarc subdomain |
| Standard | RFC 7208 | RFC 6376 | RFC 7489, updated by RFC 9989 |
| Breaks when | Mail is forwarded | Message content is modified | Neither SPF nor DKIM aligns |
| Reports | None | None | Aggregate and failure reports |
The most common misunderstanding is thinking that passing SPF is enough. It is not. A message can pass SPF for a third-party domain while the From address shows yours, and the reader will never know. Only DMARC connects the authentication result to the address the reader actually sees.
Our guide to what DMARC is and how to set it up walks through that connection in detail.
The companion guide to what DKIM is covers signing and key rotation.
How do I set up SPF, DKIM and DMARC?
Set them up in this order: SPF and DKIM for every legitimate sender first, then DMARC at p=none, then tighten the policy once your reports show clean results. Rushing straight to p=reject is the most common way to block your own mail.
- List every sender. Include your mail provider, your website's contact forms, your CRM, your invoicing tool and any marketing platform. Miss one and its mail will start failing.
- Publish your SPF record. Add a TXT record with all your senders, for example
v=spf1 include:_spf.google.com include:spf.protection.outlook.com ~all. Keep the lookup count under 10 and use only one SPF record per domain. - Enable DKIM. Your mail provider generates a key pair, publishes the public key in DNS under a selector, and starts signing outgoing mail. Most providers do this in a few clicks in the admin console.
- Publish DMARC at p=none. Start with
v=DMARC1; p=none; rua=mailto:[email protected]. This changes nothing about delivery but starts the flow of aggregate reports. - Read the reports for two to four weeks. Look for legitimate senders that fail authentication and fix them by adding them to SPF or enabling aligned DKIM signing.
- Move to p=quarantine, then p=reject. Use
pct=to apply the stricter policy to a percentage of mail first, for examplep=quarantine; pct=25, and raise it gradually.
Verify each step as you go. You can check your SPF record with our free SPF checker.
Check your DKIM setup with the DKIM checker.
Then confirm your DMARC record with the DMARC checker. Google notes it can take up to 48 hours for SPF changes to take effect everywhere, so re-check after a day or two.
What do DMARC policies p=none, quarantine and reject mean?
A DMARC policy tells receiving servers what to do with mail that fails authentication. There are three policies, and they form a ladder from monitoring to full enforcement.
At p=none, receivers deliver failing mail as normal and send you aggregate reports. This is the safe starting point and the only policy you should use until you know every legitimate sender is authenticated. At p=quarantine, failing mail is delivered to spam or junk instead of the inbox. At p=reject, failing mail is refused outright and never delivered.
The pct= tag lets you enforce a policy on only a percentage of failing mail, which is how large organizations roll out enforcement safely. You can also set different policies for subdomains with the sp= tag. Many organizations keep subdomains at p=reject while the main domain is still being monitored, because attackers love to spoof unused subdomains.
DMARC reports are the other half of the value. Aggregate reports (rua=) arrive daily as XML files summarizing how much mail claimed to be from your domain, which servers sent it and whether it passed. Failure reports (ruf=) give per-message detail but are sent by fewer receivers and can contain message samples, so most small organizations rely on aggregate reports plus a report-parsing tool.
Why does SPF fail when email is forwarded?
SPF usually fails when mail is forwarded, because the forwarding server's IP address is not on your SPF list. DKIM usually survives forwarding, which is why DKIM is the more reliable route to a DMARC pass.
When a recipient auto-forwards your message to another address, the message is re-sent from the forwarder's server. SPF checks that server against your record, finds no match and fails. DKIM, by contrast, travels with the message: as long as the forwarder does not change any signed headers or the body, the signature still verifies and DMARC still passes through DKIM.
Mailing lists cause the same problem in the other direction. A list server often rewrites the subject line or adds a footer, which breaks the DKIM signature, and sends from its own server, which breaks SPF. That is why list mail frequently fails DMARC, and why the ARC (Authenticated Received Chain) standard exists: it lets each handler record its own authentication results so the final receiver can trust the chain.
If your users forward mail to personal Gmail accounts or your customers use mailing lists, do not panic about SPF failures. Check whether DKIM passes instead. If DKIM passes with alignment, DMARC passes and delivery is unaffected. The fix for forwarding problems is almost always "make sure DKIM signing is aligned", not "add the forwarder to SPF".
What are the limits of SPF, DKIM and DMARC?
SPF, DKIM and DMARC stop exact-domain spoofing, but they do not stop every email attack. Knowing the gaps keeps you from treating a p=reject record as a finished job.
- Look-alike domains. DMARC cannot stop
example-support.comorexamp1e.com. The attacker owns that domain and can publish valid SPF, DKIM and DMARC records for it. You need look-alike domain monitoring and staff training for this gap. - Compromised accounts. Mail sent from a genuinely hacked mailbox passes every check, because it really does come from an authorized server with a valid signature.
- Display-name tricks. A message from
[email protected]with the display name "Your CEO" passes authentication for Gmail's domain. Readers who only look at the name will still be fooled. - No content inspection. Authentication says nothing about whether the message is safe. A perfectly authenticated message can still carry a malicious link or a fraudulent payment request.
- Phishing and spoofing remain the most-reported internet crime. The FBI's Internet Crime Complaint Center received 191,561 phishing and spoofing complaints in 2025, which is why authentication must sit alongside other controls.
The controls that cover these gaps are familiar: phishing-resistant MFA such as passkeys, so a stolen password is not enough; a call-back rule for payment changes, so no email alone can move money; and regular phishing simulations, so staff recognize the attacks that authentication cannot block.
Our spear phishing guide explains how targeted attacks get past filters.
The phishing email examples show what the messages actually look like.
The bottom line
SPF lists who may send your mail, DKIM proves it was not tampered with, and DMARC ties both to the address your reader sees and decides what happens to failures. Set up SPF and DKIM first, publish DMARC at p=none, read your reports, and climb the ladder to p=reject.
Once your own domain is protected, check the result in seconds with the free DMARC checker. It takes less than a minute, and it is the fastest way to confirm that nobody else can send email as you.
Frequently asked questions
What is the difference between SPF, DKIM and DMARC?
SPF checks whether the sending server is allowed to send mail for your domain. DKIM checks a cryptographic signature to prove the message was not changed in transit. DMARC checks whether either result matches the visible From address and tells receivers what to do with mail that fails.
Do I need all three, or is one enough?
You need all three for real protection. SPF alone does not check the From address your reader sees, DKIM alone does not say what to do with failures, and DMARC alone cannot authenticate anything. Major mailbox providers also require all three for bulk senders.
What happens if I only publish SPF and DKIM but no DMARC record?
Your mail can still be authenticated, but receivers have no instruction for what to do when authentication fails, and you get no reports about abuse of your domain. Attackers can still spoof your exact domain in the From address and many receivers will deliver the fake mail.
How long does it take for SPF, DKIM and DMARC to start working?
DNS changes usually propagate within a few hours, though Google notes it can take up to 48 hours for SPF to start working. DKIM starts working as soon as your mail provider signs outgoing mail and the public key is published. DMARC at p=none starts reporting immediately.
Why did my legitimate email fail DMARC?
The most common causes are forwarding, which usually breaks SPF, and a third-party sender that is not included in your SPF record or not signing with an aligned DKIM domain. Check the Authentication-Results header of the failed message to see exactly which check failed.
Can SPF, DKIM and DMARC stop all phishing?
No. They stop attackers from spoofing your exact domain, but they cannot stop look-alike domains, messages sent from a genuinely hacked account, or phishing sent from a domain the attacker owns. You still need phishing-resistant MFA, staff training and look-alike domain monitoring.
What is DMARC alignment?
Alignment means the domain that passed SPF or DKIM matches the domain in the visible From address. With relaxed alignment, a subdomain such as mail.example.com can align with example.com. With strict alignment, the domains must match exactly.
Is DMARC required by Gmail and Outlook?
Yes, for bulk senders. Google requires bulk senders to publish SPF, DKIM and DMARC, and Microsoft began requiring domains sending more than 5,000 emails a day to Outlook.com and Hotmail to pass SPF and DKIM and have a valid DMARC policy from 5 May 2025.
Sources
- IETF — RFC 7208: Sender Policy Framework (SPF) for Authorizing Use of Domains in Email
- IETF — RFC 6376: DomainKeys Identified Mail (DKIM) Signatures
- IETF — RFC 7489: Domain-based Message Authentication, Reporting, and Conformance (DMARC)
- Google Workspace Help — Set up SPF
- FBI Internet Crime Complaint Center — 2025 IC3 Annual Report
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against RFC 7208 (SPF), RFC 6376 (DKIM), RFC 7489 (DMARC) and Google Workspace Help.
How we write and fact-check →