Key Takeaways
- SPF (Sender Policy Framework) specifies which mail servers are authorized to send emails on behalf of your domain, but it has built-in SPF limitations that can cause deliverability issues if not managed properly.
- The SPF specification caps DNS lookups at 10 per SPF check, including lookups caused by “include,” “a,” “mx,” “ptr,” and “redirect” mechanisms.
- Exceeding the limit triggers an “SPF PermError: too many DNS lookups,” which fails SPF verification and is interpreted by DMARC as a fail, potentially blocking emails from the inbox.
- Mechanisms like “ip4” and “ip6” do not count toward the limit, while “include” and “mx” can consume multiple lookups each, especially with nested references.
- To stay within the limit, remove unused services, avoid “ptr” and “mx” where possible, replace lookup-heavy mechanisms with direct IP references, and consider automated SPF record flattening.
Your SPF record might be silently killing your email deliverability, and you’d never know it just by looking at it.
SPF, or Sender Policy Framework, is one of the foundational email authentication protocols used to prevent domain spoofing and phishing attacks. But every time you add a new email service provider, marketing platform, or third-party tool, your SPF record grows, and with it, the number of DNS lookups required to verify it.
This guide breaks down the SPF limitations you need to know, explains why the 10 DNS lookup limit exists, and walks you through how to detect, fix, and prevent SPF failures before they damage your domain reputation.
What is SPF and How Does it Work?
SPF is an email authentication protocol designed to protect your domain from being used for email spoofing. It works by specifying which mail servers are authorized to send emails on behalf of your domain, and it gives receiving servers a way to verify whether an incoming message is legitimate.
How SPF authentication works
The SPF record is a DNS TXT record used for performing the email authentication process.
When you publish an SPF record for your domain, you’re essentially telling the world which IP addresses and mail servers are allowed to send email using your domain name. Here is what happens when an email is sent:
- The receiving server checks the sender’s return-path address and looks up the SPF record for that domain
- The server evaluates the SPF record to determine whether the sender’s IP address matches the authorized IP addresses listed
- If the sender IP address matches, the email passes the SPF check
- If it doesn’t match, the email fails SPF verification, and the receiving server handles it based on the domain’s SPF policy and DMARC configuration
SPF allows the recipient’s server to verify if the email is actually coming from the source it’s claiming to be. This makes it a critical first line of defense against spoofing and a key component in achieving DMARC compliance.
What is the SPF 10 DNS Lookup Limit?
The SPF specification imposes a strict cap on how many DNS lookups can occur during a single check.
An SPF policy may not require more than 10 terms that require additional DNS lookups to evaluate. This includes any lookups triggered by mechanisms like “include,” “a,” “mx,” “ptr,” and the “redirect” modifier.
What counts toward the limit
SPF records use a combination of mechanisms and modifiers to define which servers are authorized to send email for your domain.
Some of these require the receiving mail server to perform additional DNS queries to resolve them, and each query counts toward the 10 DNS lookup limit. The mechanisms and modifiers that require DNS lookups include:
- include — triggers a lookup for another domain’s SPF record, plus any nested lookups within it
- a — requires a DNS query to resolve the A or AAAA records for the specified domain
- mx — requires a DNS query to resolve the MX record, followed by additional queries to resolve the IP addresses of each mail server listed
- ptr — requires a DNS ptr query to perform a reverse lookup, and is strongly discouraged due to its unreliability and potential to cause multiple additional lookups
- redirect — triggers a lookup for the SPF record of the redirected domain
- exists — requires a DNS query to check if a specific domain resolves
If the SPF record contains many mechanisms, especially nested includes, it can quickly exceed the 10 DNS lookup limit.
What does not count toward the limit
The following mechanisms and elements do not count toward the 10 lookup limit:
- ip4 and ip6 — these specify authorized IP addresses directly, requiring no additional DNS resolution
- all — the catch-all mechanism at the end of the record does not require a lookup
- The initial DNS query for the SPF policy record itself — the DNS query to retrieve the SPF TXT record from the domain’s DNS does not count toward the limit
- v=spf1 — the version tag that identifies the record as SPF
Using ip4 or ip6 mechanisms in SPF records does not require additional lookups and can help stay within the limit. This is why replacing lookup-heavy mechanisms with direct IP references is one of the most effective optimization strategies.
Simplify Security with PowerDMARC!
Why the SPF 10 Lookup Limit Exists
The 10 DNS lookup limit might seem restrictive, especially for organizations using multiple email service providers, but it exists for important security and performance reasons.
Preventing denial-of-service attacks
The limit of 10 additional lookups is imposed to avoid unreasonable load on the DNS and to prevent Denial-of-Service (DoS) attacks.
Without this cap, an attacker could craft an SPF record with hundreds of nested includes, forcing every receiving mail server that processes an email from that domain to perform an enormous number of DNS queries. This could overwhelm DNS servers and degrade performance across the internet.
Ensuring timely email processing
Every DNS lookup during an SPF check adds latency to the email delivery process. If SPF records were allowed unlimited lookups, the time required for SPF verification could grow significantly, leading to dns query timeouts and temporary dns server issues.
The 10 lookup limit ensures that SPF checks can be completed quickly and reliably without creating bottlenecks in email delivery.
Maintaining DNS stability
DNS infrastructure is a shared resource. Allowing uncapped lookups during SPF authentication would put excessive strain on recursive resolvers and authoritative nameservers, particularly for high-volume senders.
The limit protects the broader DNS ecosystem by keeping SPF-related query volumes manageable.
What Happens When You Exceed the SPF Lookup Limit
Exceeding the SPF lookup limit doesn’t just result in a minor warning. It causes a hard failure that can directly impact whether your emails reach your recipients’ inboxes.
SPF PermError and verification failure
When the SPF implementation on the receiving email server encounters more than 10 DNS-querying mechanisms or modifiers in the sender’s domain’s SPF record, it returns “SPF PermError: too many DNS lookups.”
According to the SPF specification, if a receiver exceeds the DNS lookup limit while evaluating the SPF policy, it must fail the SPF verification for that message with a permerror.
This means the email does not simply get a “soft” fail or neutral result. It receives a permanent error that tells the receiving server the SPF record cannot be evaluated at all.
Impact on DMARC and email deliverability
If your DMARC policy is set to quarantine or reject, emails that trigger an SPF PermError may be sent to spam or blocked entirely.
Exceeding the SPF lookup limit impacts email deliverability by reducing the probability of emails landing in the primary inbox of the intended recipients. Over time, repeated SPF failures can also hurt your domain reputation, making it harder for even legitimate emails to get delivered.
Other SPF PermError causes
While exceeding the 10 DNS lookup limit is the most common cause of SPF PermError, it is not the only one. An SPF PermError can also occur when:
- The SPF record contains syntax errors that prevent it from being correctly interpreted
- Multiple SPF records are published for a single domain, which violates the SPF specification
- The record uses deprecated or unsupported mechanisms
- Circular includes create an infinite loop in the lookup chain
Any of these issues can lead to SPF failure and undelivered emails, so it’s important to validate your entire SPF configuration regularly.
How to Check if Your SPF Record Exceeds the Limit
Identifying whether your SPF record is over the 10 DNS lookup limit is the first step toward fixing deliverability issues. There are several ways to run an SPF record check and verify your current lookup count.
Use an SPF diagnostic tool
Using an SPF diagnostic tool can help verify that an SPF record is valid and functioning correctly. These tools parse your SPF record, count every DNS lookup including nested includes, and flag any errors or warnings.
PowerDMARC’s free SPF record checker lets you instantly see your total lookup count, identify which mechanisms are consuming the most queries, and spot misconfigurations before they cause delivery problems.
Manually trace your SPF record
If you prefer to inspect your SPF record yourself, you can manually count the DNS lookups by walking through each mechanism in the record.
Start with your domain’s SPF TXT record and count every “include,” “a,” “mx,” “ptr,” “redirect,” and “exists” mechanism. Then, for each “include,” look up the referenced domain’s SPF record and count its lookup-causing mechanisms as well.
Nested includes add up quickly, which is why organizations that use multiple email service providers often exceed the limit without realizing it.
Monitor SPF validation over time
SPF records are not static. As you add or remove email service providers, change hosting environments, or update your email infrastructure, your SPF record changes too. It is recommended to validate SPF records after making changes to ensure compliance with the 10 lookup limit.
Setting up ongoing monitoring through PowerDMARC’s platform gives you continuous visibility into your SPF configuration and alerts you when changes push your record over the limit.
How to Fix and Optimize Your SPF Record
If your SPF record exceeds or is approaching the 10 DNS lookup limit, there are several practical steps you can take to reduce your lookup count without sacrificing email authentication coverage.
Remove unused or unrequired services
The most straightforward optimization is to audit your SPF record and remove any mechanisms that reference services you no longer use.
Over time, organizations add email service providers, marketing platforms, and third-party tools to their SPF record but forget to remove them when they’re no longer active.
To reduce the number of required lookups, organizations should remove unused services from their SPF record. This also means removing default SPF values that were added during initial setup but serve no current purpose.
Replace lookup-heavy mechanisms with ip4 or ip6
Every “include,” “a,” and “mx” mechanism requires at least one DNS lookup. Where possible, replace these with ip4 or ip6 mechanisms that specify the authorized IP addresses directly. Using ip4 or ip6 mechanisms in SPF records does not require additional lookups and can help maintain compliance with the lookup limit.
For example, if an email service provider’s SPF record resolves to a known set of static IP addresses, you can list those IPs directly rather than using an “include” that triggers multiple DNS lookups.
Avoid the ptr mechanism
The use of the ptr mechanism is strongly discouraged as it can cause an increase in required lookups, leading to permerror issues.
The ptr mechanism performs a reverse DNS lookup for every connecting IP, which is both slow and unreliable. The SPF specification itself recommends against using it. If your SPF record currently includes a ptr mechanism, remove it and replace it with direct IP references.
Minimize use of the mx mechanism
Avoiding the mx mechanism in SPF records can help stay within the 10 DNS lookup limit. The mx mechanism first resolves the domain’s MX record and then performs additional lookups to resolve the IP address of each listed mail server.
If your domain has multiple MX records, a single “mx” mechanism can consume several lookups. Replace it with ip4 or ip6 entries for your mail servers where possible.
Consolidate include statements
If your SPF record has multiple “include” mechanisms pointing to related services, check whether they can be consolidated.
Some email service providers share overlapping infrastructure, meaning you may be performing redundant lookups. Review each include to determine whether it’s still necessary and whether the underlying IP addresses can be referenced directly.
Validate after every change
Validating SPF records after making changes is essential to ensure compliance with the 10 lookup limit.
Even a small modification, such as adding a single new “include” for a marketing platform, can push your record over the limit if it triggers nested lookups. Run your record through an SPF diagnostic tool after every update to confirm it remains valid.
SPF Record Flattening: What it is and When to Use it
SPF record flattening is a technique used to optimize SPF records to overcome the 10 DNS lookup limit for SPF. It’s one of the most discussed solutions for organizations with complex email infrastructures, but it comes with trade-offs that are important to understand.
How SPF record flattening works
SPF record flattening replaces lookup-causing mechanisms in an SPF record with their corresponding IP addresses or CIDR ranges, reducing the number of DNS queries required to verify the SPF record.
Instead of including a reference like “include:emailprovider.com” that triggers one or more DNS lookups, you resolve that reference to its underlying IP addresses and list them directly in your record using ip4 or ip6 mechanisms.
For example, if “include:emailprovider.com” resolves to three IP addresses, flattening replaces the include statement with those three ip4 entries. The SPF check now returns the same result without requiring any additional DNS queries for that provider.
When flattening helps
Flattening an SPF record can reduce the number of DNS-querying mechanisms and modifiers so that it’s smaller than 10. This is particularly useful when:
- Your domain sends email through many third-party services and the include count alone exceeds 10
- You’ve already removed unused services and consolidated where possible but are still over the limit
- You need a quick way to bring your record into compliance while planning a longer-term optimization strategy
The risks of manual flattening
While SPF record flattening solves the lookup limit problem, it introduces a maintenance challenge. The underlying IP addresses of your email service providers can change without notice.
If a provider adds, removes, or rotates IP addresses and your flattened record still references the old ones, legitimate emails sent from the new IPs will fail SPF inspection.
Manually maintaining a flattened SPF record requires constant monitoring to ensure the listed IP addresses stay current. This is why manual flattening is generally not recommended as a long-term solution for organizations with dynamic email infrastructures.
Other SPF Record Limitations to Know
The 10 DNS lookup limit is the most well-known SPF limitation, but it’s not the only one. Domain owners should be aware of these additional SPF record limitations to avoid unexpected authentication failures.
Only one SPF record per domain
The SPF specification requires that each domain publishes only a single SPF TXT record.
If the SPF record contains multiple SPF records for a domain, it can lead to an SPF PermError, and the receiving server may reject or mishandle the email. If you need to authorize additional senders, add them to your existing SPF record rather than creating a second one.
SPF checks the return-path, not the From address
SPF authenticates the domain in the return-path address, not the human-readable From field that the recipient sees. This means an attacker can spoof the From address while passing SPF by using a different return-path domain.
DMARC addresses this gap by requiring a match or alignment between the human-readable From field domain and the domain authenticated by SPF.
The 255-character string limit
While an SPF record can contain more than 255 characters total, a single DNS TXT record string is limited to 255 characters. Longer SPF records need to be split into multiple strings within the same TXT record.
Most DNS providers handle this automatically, but misconfigured splits can cause parsing errors.
Void lookup limit
In addition to the 10 DNS lookup limit, the SPF specification also limits the number of “void lookups,” which are DNS queries that return no records (either an empty answer or an NXDOMAIN response).
Exceeding this limit, which is typically two void lookups, can also trigger an SPF PermError.
No protection for forwarded emails
When an email is forwarded, the sending IP changes to the forwarding server’s IP, which is unlikely to be listed in the original sender’s SPF record. This causes the forwarded email to fail SPF checks even though it was originally legitimate.
Keep Your SPF Record Optimized With PowerDMARC
SPF is essential for email authentication, but its built-in limitations can quietly undermine your email deliverability if left unchecked. A single extra “include” or an overlooked deprecated mechanism can push your record past the 10 DNS lookup limit, causing SPF failures that block legitimate emails from reaching your recipients.
PowerDMARC takes the complexity out of SPF management.
With automated SPF flattening, real-time lookup monitoring, instant error alerts, and a full suite of tools for SPF, DKIM, DMARC, and BIMI, PowerDMARC helps you stay within the lookup limit and maintain a clean authentication configuration at all times.
Don’t let SPF limitations silently damage your email deliverability. Contact us today!
Frequently Asked Questions
1. What happens if my SPF record exceeds the 10 DNS lookup limit?
When your SPF record exceeds the 10 DNS lookup limit, the receiving mail server will return a “Permerror” result. This causes SPF authentication to fail, which can lead to your legitimate emails being rejected, marked as spam, or delivered with reduced reputation.
2. How can I check how many DNS lookups my SPF record uses?
You can use online SPF validation tools like PowerDMARC’s free SPF checker to analyze your record and count DNS lookups. These tools will show you exactly which mechanisms are causing lookups and help you identify optimization opportunities. You can also manually trace through your SPF record, counting each ‘include’, ‘a’, ‘mx’, and ‘ptr’ mechanism.
3. What are the best practices for maintaining an SPF record within the lookup limit?
Best practices include: regularly auditing your SPF record to remove unused services, using IP addresses instead of includes where possible, avoiding the ‘a’ and ‘mx’ mechanisms unless necessary, consolidating multiple email services, implementing SPF flattening for complex setups, and monitoring your SPF record that alert you to changes in lookup counts.
- Quid Pro Quo Social Engineering Attacks: How They Work and How to Stop Them - March 3, 2026
- 5 Enterprise Vendor Risk Management Solutions: 2026 TPRM Platforms Comparison - March 3, 2026
- 10 Automated Solutions for Email Spoofing Prevention - February 26, 2026
