Each SPF record should not have more than 10 DNS lookups; otherwise, validation failures are triggered. SPF records of organizations with an intricate email infrastructure are more likely to hit this limit and experience permanent errors. This is where the process of SPF flattening steps in to keep the records within the limit of 10 queries, helping in improving email deliverability and compliance.
What is SPF flattening?
SPF flattening reduces the number of DNS lookups by simplifying and optimizing SPF records. It helps domain owners stay within the limit specified by RFC by consolidating nested ‘include:’ statements and replacing indirect references with corresponding IPs. This turns the SPF record into a single, comprehensive entity.

How is SPF flattening done?
You can manually flatten an SPF record, but that’s a bit time and resource-consuming. Moreover, this approach has a higher chance of errors and misconfigurations. So, it’s better to use automatic SPF flattening tools.
Nonetheless, here is how you can do it manually-
- Check SPF records – Find all includes and nested lookups.
- Simplify lookups – Replace includes with direct IPs or CIDR ranges.
- Test the record – Review it manually in DNS or use an online SPF checker to confirm it works properly.

Importance of SPF flattening
Here’s why SPF flattening is beneficial for SPF records that have exceeded the lookup limit–
Staying compliant
SPF records must follow DNS lookup limits. Flattening helps keep them within these limits, ensuring compliance with the RFC rules set by the IETF for email authentication and maintaining your domain’s trustworthiness with email servers.
Enhanced email deliverability
When an SPF record is configured correctly and has no permerrors triggering, it efficiently performs authentication checks. If all your outgoing emails undergo authentication checks and are correctly categorized as legitimate and illegitimate, receiving mailboxes will start perceiving your domain as credible and valuable. This leads to enhanced email deliverability, which means most of your emails will land in the primary inboxes of recipients.

Prevention from phishing and spoofing
Using SPF with DMARC and flattening SPF helps prevent phishing and spoofing. If SPF exceeds the limit, it can fail, causing DMARC to fail even for genuine emails. Moreover, threat actors are adept at exploiting vulnerabilities in email authentication protocols. So, if your SPF record exceeds the lookup limit, they know how to pivot that to their advantage, send phishing emails from your domain, and bypass authentication filters.
Don’t underestimate frequent evaluations
SPF records change frequently as email providers update their IPs and servers. Manually flattened SPF records can become outdated, causing lookup errors, so regular reviews are essential.

Overcomplicated SPF setups can lead to errors. Flattening replaces ‘include:’ statements with IPs, which may make the record too long (over 255 characters), so manage it carefully.
Use our free automatic SPF flattening tool if your SPF record has exceeded the limit and you are not able to fix it despite every effort. Contact us for any help.