Free tool
SPF syntax checker
Paste a draft SPF record to check its syntax before you publish it. The checker validates the v=spf1 tag, every mechanism and qualifier, the all policy and the DNS lookup count, without touching DNS. Want the record that is live on a domain now? Use the SPF checker. Starting from scratch? Build one with the SPF record generator.
Check SPF record syntax
Paste an SPF record to validate its syntax and see each mechanism
Enter the complete SPF record including v=spf1
Syntax Check
Validate SPF record format
DNS Lookups
Count DNS lookup mechanisms
Best Practices
Get optimization suggestions
Why Analyze SPF Records?
SPF records can fail due to syntax errors, too many DNS lookups, or incorrect mechanisms. This tool helps identify issues before deploying to DNS.
Get SPF Management HelpWalkthrough
Watch: check an SPF draft in under a minute
A 44-second walkthrough of the four checks: the record starts with v=spf1, it stays within 10 DNS lookups, the all rule at the end, and deprecated terms such as ptr. A raw check only reads the text you paste, so after you publish, run the live SPF checker too: it follows nested includes.
How to use the SPF syntax checker
Step 1
Paste the full record
Paste the draft starting with v=spf1, without the surrounding quotes some DNS panels show. Or click Load Example to see a valid record.
Step 2
Run the check
Click Analyze SPF Record, or press Enter in the box. The check reads only the text you pasted.
Step 3
Read the verdict
You get Valid or Invalid, the DNS lookup count out of 10, the character count, the all policy, and a line for every mechanism.
Step 4
Fix, re-check, publish
Fix each error and warning, run it again, then publish the record and confirm it with the SPF checker.
What this SPF syntax checker validates
The checker splits the record on spaces and reads each term's qualifier, mechanism and value. It marks a record Invalid for three errors and raises a warning for six other problems.
Errors: record is invalid
- The record does not start with v=spf1.
- More than 10 terms that cost a DNS lookup: include, a, mx, ptr, exists and redirect.
- The record ends in +all, which authorizes every server.
Warnings: fix before publishing
- Unknown mechanism: a term it doesn't recognize, usually a typo.
- ptr is used. It is deprecated and slow.
- No all mechanism, so there is no explicit policy.
- ?all, which gives no protection.
- The record is longer than 255 characters.
- More than 5 include statements.
SPF record syntax reference
An SPF record is one line of text published as a TXT record. It starts with the version tag, followed by terms separated by single spaces. Each mechanism takes an optional qualifier in front and, for most mechanisms, a value after a colon. Receivers read the terms left to right and stop at the first one that matches the sending server, so the all mechanism goes last.
v=spf1 [qualifier]mechanism[:value] ... [qualifier]all v=spf1 ip4:192.0.2.10 include:_spf.google.com ~all
Mechanisms
| Mechanism | Example | Matches | DNS lookup |
|---|---|---|---|
| ip4 | ip4:192.0.2.10 or ip4:198.51.100.0/24 | An IPv4 address or range | No |
| ip6 | ip6:2001:db8::/32 | An IPv6 address or range | No |
| include | include:_spf.google.com | Any server the other domain's SPF record passes | Yes |
| a | a or a:mail.example.com | The IP addresses in the domain's A or AAAA record | Yes |
| mx | mx or mx:example.com | The servers in the domain's MX records | Yes |
| exists | exists:%{i}.spf.example.com | Any server for which the given name has an A record | Yes |
| ptr | ptr | Reverse DNS of the sender. Deprecated: don't use it | Yes |
| all | ~all or -all | Everything not matched earlier. Goes last | No |
Qualifiers
| Qualifier | Result on a match |
|---|---|
| + (default) | Pass. Used when no qualifier is written, so include:x means +include:x |
| - | Fail. -all rejects unlisted servers |
| ~ | Soft fail. ~all accepts unlisted servers but marks them suspicious |
| ? | Neutral. No statement either way |
Modifiers
| Modifier | What it does |
|---|---|
| redirect=_spf.example.com | Uses another domain's SPF record instead of this one when nothing else matches. Costs a DNS lookup. Don't combine it with all |
| exp=explain.example.com | Points to a TXT record with a message for rejected senders. No lookup counted |
Common SPF syntax errors and how to fix them
Each row shows a broken record, the corrected version and what this checker reports for the broken one. An unknown mechanism appears here as a warning, but receivers return a permanent error for it, so fix every one.
| Problem | Broken | Fixed | Checker reports |
|---|---|---|---|
| Missing version tag | spf1 include:_spf.google.com ~all | v=spf1 include:_spf.google.com ~all | SPF record must start with "v=spf1" |
| Quotes pasted with the record | "v=spf1 include:_spf.google.com ~all" | v=spf1 include:_spf.google.com ~all | SPF record must start with "v=spf1" |
| Misspelled mechanism | v=spf1 inlcude:_spf.google.com ~all | v=spf1 include:_spf.google.com ~all | Unknown mechanism: inlcude:_spf.google.com |
| Equals sign instead of colon | v=spf1 include=_spf.google.com ~all | v=spf1 include:_spf.google.com ~all | Unknown mechanism: include=_spf.google.com |
| Policy passes everyone | v=spf1 include:_spf.google.com +all | v=spf1 include:_spf.google.com ~all | "all" mechanism allows all servers. This makes SPF useless |
| No policy at the end | v=spf1 include:_spf.google.com | v=spf1 include:_spf.google.com ~all | No "all" mechanism found. Consider adding one for explicit policy |
| Deprecated ptr | v=spf1 ptr include:_spf.google.com ~all | v=spf1 ip4:192.0.2.10 include:_spf.google.com ~all | PTR mechanism is deprecated and should be avoided |
| Too many lookups | 11 or more include, a, mx, ptr or exists terms | Replace a and mx with ip4, drop unused includes | SPF record exceeds 10 DNS lookup limit |
What a syntax check can't see
This checker reads one string, so it can't tell whether your domain already has a second SPF record, which breaks SPF, and it doesn't expand includes, so the real lookup total can be higher than the count shown here. After you publish, look up the domain with the SPF checker, which reads the live record and counts the includes inside each include. To start a record from scratch, use the SPF record generator, and read how SPF fits with DKIM and DMARC in the email authentication guide.
Related SPF tools
SPF Checker
Look up the live SPF record on any domain.
SPF Generator
Create properly formatted SPF records easily.
Deliverability Score
Complete domain authentication analysis.
DNS Checker
Verify all email authentication DNS records.
DKIM Checker
Validate DKIM signatures and keys.
DMARC Checker
Analyze DMARC policy configuration.
FAQ
Frequently asked questions
It reads the text of an SPF record and checks the syntax without looking anything up in DNS. This checker confirms the record starts with v=spf1, parses every mechanism and qualifier, counts the terms that cost a DNS lookup, checks the all policy at the end, and lists every error and warning so you can fix the draft before you publish it.
The SPF syntax checker validates a record you paste in, so you can test a draft before it goes live. The SPF checker takes a domain name and looks up the record that is already published in DNS. Use the syntax checker before you publish and the SPF checker after.
An SPF record is one line of text. It starts with v=spf1, followed by terms separated by single spaces. Each mechanism can take an optional qualifier (+, -, ~ or ?) and a value after a colon, such as include:_spf.google.com or ip4:192.0.2.10. Modifiers use an equals sign, such as redirect=_spf.example.com. Most records end with ~all or -all. Example: v=spf1 ip4:192.0.2.10 include:_spf.google.com ~all
A missing or misspelled v=spf1 at the start, quotes pasted along with the record, a misspelled mechanism such as inlcude:, an equals sign where a colon belongs (include= instead of include:), more than 10 DNS lookups, a +all that authorizes every server on the internet, and a missing all at the end. This checker reports each of these.
A term in the record is not a mechanism or modifier the checker recognizes. It is usually a typo (inlcude:, ipv4:), the wrong separator (include= instead of include:), or a stray quote or character stuck to a term. Receivers return a permanent error for an unknown mechanism, which fails SPF, so treat this warning as an error and fix it before publishing.
include, a, mx, ptr and exists each cost one lookup, and so does the redirect modifier. ip4, ip6, all and exp cost nothing. This checker counts the lookup terms written in the record you paste. It does not expand includes, and each include can trigger more lookups of its own, so check the live total with the SPF checker after publishing.
+all passes every server on the internet, so anyone can send as your domain and pass SPF. The checker marks a record with +all as invalid. ?all is neutral: it tells receivers nothing about unlisted servers, so it gives no protection, and the checker warns about it. Use ~all while testing and -all once every sender is listed.
Not by itself. A single string in a DNS TXT record holds up to 255 characters, so a longer SPF record has to be split into several quoted strings inside the same TXT record, which receivers join back together. Many DNS providers do the split for you. It is still one SPF record. The checker warns when a record passes 255 characters so you can confirm how your provider handles it.
No. A valid result means the syntax is correct. SPF passes only when the server that sends a message is covered by the published record, the domain has exactly one SPF record, and the full lookup count, including nested includes, stays at 10 or fewer. Publish the record, then confirm it with the SPF checker and a test email.
Simplify SPF management
Inboxkit automatically optimizes SPF records and manages the 10-lookup limit