SPF, DKIM & DMARC Explained: The Complete Setup Guide
SPF, DKIM, and DMARC are the three pillars of email authentication. This guide explains what each one does, why you need all three, and how to set them up step by step.
If you send email from your own domain, you need SPF, DKIM, and DMARC configured correctly. Without them, your emails are more likely to land in spam, get rejected, or be spoofed by attackers.
These three DNS records form the foundation of email authentication. They tell receiving servers: "Yes, this email really came from us, and it hasn't been tampered with." Here's how each one works and how to set them up.
Check your current setup
Use our free domain health checker to instantly see your SPF, DKIM, and DMARC status — no signup required.
The Big Picture: How Email Authentication Works
When you send an email, the receiving server asks three questions:
- SPF: "Is this server authorized to send email for this domain?"
- DKIM: "Was this email tampered with in transit?"
- DMARC: "What should I do if SPF or DKIM fails?"
If all three pass, your email is trusted. If any fail and you don't have DMARC telling servers what to do, the result is unpredictable — your email might land in spam, get rejected, or be delivered normally depending on the provider.
SPF (Sender Policy Framework)
What SPF does
SPF is a DNS TXT record that lists which servers are authorized to send email on behalf of your domain. When a receiving server gets an email from you@yourdomain.com, it checks the SPF record to see if the sending server's IP is authorized.
SPF record structure
v=spf1 include:_spf.google.com include:sendgrid.net ip4:203.0.113.5 -all
Breaking it down:
v=spf1— Version identifier (always required)include:_spf.google.com— Authorize Google Workspace serversinclude:sendgrid.net— Authorize SendGrid serversip4:203.0.113.5— Authorize a specific IP address-all— Reject email from any other server (~allfor soft fail)
How to set up SPF
- List all services that send email for your domain (Gmail, Mailchimp, SendGrid, your app server, etc.)
- Look up each service's SPF include directive (usually in their docs)
- Create a single TXT record at your domain with all includes
- Use
-all(hard fail) once you're confident the list is complete
Common SPF mistakes
- Multiple SPF records — You can only have ONE SPF record per domain. Multiple records cause authentication failures.
- Too many DNS lookups — SPF has a 10-lookup limit. Each
include:counts as a lookup. Useip4:where possible. - Using
+all— This authorizes every server on the internet to send as your domain. Never do this. - Forgetting a sending service — If you use Mailchimp but forget to include it, Mailchimp emails will fail SPF.
DKIM (DomainKeys Identified Mail)
What DKIM does
DKIM adds a cryptographic signature to every outgoing email. The sending server signs the email with a private key, and the receiving server verifies the signature using a public key published in your DNS. If the signature matches, the email wasn't modified in transit.
DKIM record structure
DKIM records are published as TXT records at selector._domainkey.yourdomain.com:
v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEB...
v=DKIM1— Versionk=rsa— Key typep=...— The public key (base64 encoded)
How to set up DKIM
- Your email provider generates a key pair (Google Workspace, Microsoft 365, etc. all have guides)
- Add the public key as a DNS TXT record at the selector they specify
- The provider automatically signs outgoing emails with the private key
- Verify with our domain checker — it auto-detects common selectors
DKIM tips
- Each sending service needs its own DKIM selector (e.g., Google uses
google._domainkey) - Use 2048-bit keys when possible (more secure than 1024-bit)
- Rotate keys periodically (annually is good practice)
DMARC (Domain-based Message Authentication, Reporting & Conformance)
What DMARC does
DMARC ties SPF and DKIM together and tells receiving servers what to do when authentication fails. Without DMARC, servers decide on their own — which is unpredictable.
DMARC record structure
DMARC is a TXT record at _dmarc.yourdomain.com:
v=DMARC1; p=quarantine; rua=mailto:dmarc@yourdomain.com; pct=100
v=DMARC1— Versionp=quarantine— Policy:none(monitor),quarantine(spam folder),reject(block)rua=mailto:...— Where to send aggregate reportspct=100— Apply to 100% of emails
DMARC rollout strategy
- Start with
p=none— Monitor mode. Collects reports without affecting delivery. - Analyze reports for 2-4 weeks — Identify legitimate senders that are failing SPF/DKIM
- Fix authentication gaps — Add missing SPF includes, set up DKIM for all senders
- Move to
p=quarantine— Failed emails go to spam - Move to
p=reject— Failed emails are blocked entirely (strongest protection)
The Complete Setup Checklist
| Step | Record | Where |
|---|---|---|
| 1. List all email senders | — | Spreadsheet |
| 2. Create SPF record | TXT @ yourdomain.com | DNS provider |
| 3. Set up DKIM for each sender | TXT @ selector._domainkey.yourdomain.com | DNS provider |
| 4. Create DMARC record (monitor) | TXT @ _dmarc.yourdomain.com | DNS provider |
| 5. Verify with domain checker | — | Mailthentic tool |
| 6. Monitor reports for 2-4 weeks | — | DMARC report inbox |
| 7. Upgrade DMARC to quarantine/reject | Update TXT @ _dmarc | DNS provider |
Testing Your Configuration
After setting up all three records, verify them:
- Mailthentic Domain Checker — Free instant check of MX, SPF, DKIM, and DMARC with a health score
- Send a test email — Send to a Gmail account and click "Show original" to see SPF/DKIM/DMARC results
- Check DMARC reports — After 24-48 hours, you'll start receiving aggregate reports showing pass/fail rates
What Happens Without Proper Authentication
| Missing Record | Risk |
|---|---|
| No SPF | Anyone can send email pretending to be your domain. Receivers may flag or reject your legitimate emails. |
| No DKIM | Emails can be modified in transit without detection. Some receivers downgrade trust for unsigned emails. |
| No DMARC | No policy for handling failed authentication. Each receiver decides independently, leading to inconsistent delivery. |
The combination of all three is what matters. SPF alone is not enough. DKIM alone is not enough. You need the complete stack.
Check your domain's authentication right now
Use our free domain health checker to see your SPF, DKIM, and DMARC status in seconds. Then sign up free to verify individual email addresses with 100 credits.
Ready to verify your email list?
Start free with 100 verification credits. No credit card required.