Free SPF Flattener Tool
Use our free SPF flattener and SPF flattening tool to expand nested includes into direct IP ranges. Reduce SPF DNS lookups below 10, fix SPF permerror failures, and check UDP size limits before publishing.
How to use the free SPF flattener tool
Fixing an SPF record with too many DNS lookups takes less than one minute. Follow these steps inside the SPF flattening tool above:
- Enter your domain name (or switch to Paste Raw Draft to test an unpublished record) and click Analyze & Flatten.
- Wait two seconds as the SPF flattener walks every include:, a, and mx mechanism via live DNS-over-HTTPS queries.
- Review the selective flattening checklist. Check the boxes next to static services or high-lookup includes you want to convert into IP addresses. Uncheck Google Workspace or Microsoft 365 if you want them left dynamic.
- Watch the live counters drop your lookup total from over 10 down under the ceiling while checking the 450-byte UDP packet meter.
- Copy the single-line record or the 255-character multi-string chunks and update your TXT record in DNS.
After saving the DNS update, verify the live published syntax with our SPF Record Checker and check downstream authentication alignment using our DMARC Checker.
Why the 10 DNS lookup limit triggers SPF permerror
The Sender Policy Framework rules in RFC 7208 Section 4.6.4 state that an SPF evaluation must never require more than 10 DNS-querying mechanisms or modifiers. That limit includes nested lookups triggered inside third-party include: chains.
Once lookup 11 runs, receiving mail servers immediately stop checking your record and return permerror. Under DMARC, an SPF permerror counts as a broken authentication failure, sending valid customer invoices, CRM notifications, and cold outreach into junk folders or triggering 550 bounces.
| SPF Mechanism | Counts Toward 10 Limit? | How SPF Flattening Handles It |
|---|---|---|
| include:_spf.google.com | Yes (1+ nested) | Expands nested tree into direct IP blocks when flattened. |
| a / a:mail.example.com | Yes (1 lookup) | Resolves host A and AAAA addresses into ip4 / ip6 entries. |
| mx / mx:example.com | Yes (1 + up to 10 MX hosts) | Resolves MX hostnames then resolves each host IP. |
| redirect=otherdomain.com | Yes (1+ target tree) | Transfers evaluation to target SPF record when no root all exists. |
| exists:%{i}.spf.domain.com | Yes (1 lookup) | Uses runtime per-IP macros; kept intact as dynamic lookup. |
| ptr | Yes (1+ reverse lookup) | Deprecated by RFC 7208; replace with explicit ip4 or ip6 entries. |
| ip4:192.0.2.0/24 | No (0 lookups) | Deduplicated and merged cleanly across overlapping CIDR ranges. |
| ip6:2001:db8::/32 | No (0 lookups) | Deduplicated via 128-bit CIDR range containment. |
| ~all / -all | No (0 lookups) | Preserved at the end of the flattened record without modification. |
How nested includes reduce your lookup budget fast
Adding just three SaaS marketing and helpdesk platforms often exceeds 10 lookups because each vendor include can call nested sub-domains behind the scenes. Here is how many lookups common business senders cost:
| Email Platform | Published Include | DNS Lookups Cost |
|---|---|---|
| Google Workspace | include:_spf.google.com | 1 lookup |
| Microsoft 365 | include:spf.protection.outlook.com | 1 lookup |
| Salesforce Marketing / CRM | include:_spf.salesforce.com | 2 lookups |
| Zendesk Support | include:mail.zendesk.com | 1 to 3 lookups |
| Mailgun | include:mailgun.org | 5 lookups |
| Freshdesk | include:email.freshdesk.com | 7 lookups |
| HubSpot (Dedicated) | include:<hubid>.spf.hubspotemail.net | 1 lookup |
Also check whether an app actually needs to be listed on your root domain. Services like Mailchimp, Klaviyo, and Postmark use their own Return-Path domains by default, meaning an include on your main domain wastes lookups for nothing.
Managing the 450-byte UDP limit and 255-character DNS chunks
SPF flattening trades DNS lookups for character length. Replacing many third-party services with raw ip4: and ip6: CIDR blocks can make the TXT string large. Two strict DNS rules apply:
450-Byte UDP Packet Target (RFC 7208 Section 3.4)
Standard unextended DNS answers over UDP top out at 512 bytes. RFC 7208 advises keeping SPF TXT strings near or below 450 bytes so the full DNS packet (including headers) fits in a single UDP response. When the byte meter turns amber or red, use selective flattening or move marketing mail onto a subdomain like mail.yourdomain.com.
255-Character String Chunking (RFC 1035)
DNS TXT records are made of one or more character strings, each capped at 255 octets. When an SPF flattened record exceeds 255 bytes, our tool splits it cleanly between terms into adjacent quoted strings like:
"v=spf1 ip4:198.51.100.0/24 ip4:203.0.113.0/24 " "include:_spf.google.com ~all"
Selective SPF flattening vs full static SPF flattening
Full static flattening removes every single include: and writes out dozens of hardcoded IP ranges. While that gets you to zero lookups, major cloud email hosts like Google Workspace and Microsoft 365 periodically add or swap sending server ranges across global data centers.
Selective SPF flattening gives you the safest balance. Leave high-churn cloud suites as dynamic includes (costing only 1 or 2 lookups out of your 10 budget), and flatten high-lookup third-party tools like Freshdesk (7 lookups) or fixed-IP transactional gateways. Our tool deduplicates overlapping subnets via bitwise containment so your final flattened string is as compact as possible.
Common SPF flattening mistakes to avoid
- Turning negative terms into passing IPs: Only default + pass terms should be expanded into allowed IPs. Our SPF flattening tool preserves -, ~, and ? terms intact so blocked IPs never accidentally pass.
- Dropping the terminal policy on redirect records: If your original record used redirect= instead of ~all or -all, our flattener promotes the resolved target terminal qualifier cleanly.
- Using subnets or dedicated servers without checking blacklists: After flattening custom mail server ranges, verify those public IPs have clean DNSBL scores using our IP Reputation Checker.
- Sending outreach on unverified email addresses: Fixing SPF keeps authentication intact, but bouncing on bad mailboxes still wrecks sender score. Clean prospect lists with Giggal Email Verification.
Frequently Asked Questions
An SPF flattener queries every nested include, a, and mx mechanism inside your domain SPF record, resolves the authorized IPv4 and IPv6 addresses, removes overlapping subnets, and writes clean ip4 and ip6 entries. Because direct IP entries cost zero DNS lookups, flattening keeps your record safely under the limit of 10.
RFC 7208 Section 4.6.4 limits receiving mail servers to 10 DNS-querying mechanisms per SPF check to stop DNS denial-of-service amplification attacks. If your record triggers 11 or more lookups, receiving mail servers stop evaluating and return SPF permerror.
Use selective SPF flattening. Keep high-churn providers like Microsoft 365 and Google Workspace as dynamic includes so IP rotations never fail, while using this SPF flattening tool to expand smaller static tools or legacy relays into direct ip4 entries.
When an SPF check triggers permerror, SPF authentication fails for every message sent from that domain unless DKIM passes and aligns under DMARC. Many corporate security gateways drop or quarantine messages immediately when an SPF permerror occurs.
DNS responses sent over standard UDP packets cannot exceed 512 bytes total. RFC 7208 Section 3.4 recommends keeping your flattened SPF record around 450 bytes or smaller so older resolvers do not drop fragmented packets. RFC 1035 also limits each quoted TXT string inside DNS to 255 characters.
No. Flattening freezes current IP ranges into text. When an email vendor adds new outbound mail servers, a static flattened SPF record will not match them until you run the SPF flattener again or automate DNS updates.
A void lookup occurs when an include, a, or mx query returns NXDOMAIN or zero address answers. RFC 7208 Section 4.6.4 enforces a strict limit of 2 void lookups per check before triggering an SPF permerror.
Yes. Switch the SPF flattener tab above to "Paste Raw Draft" to test any v=spf1 string, toggle individual includes on or off, and check the lookup count and byte size before publishing changes in your DNS zone.
Protect your sender reputation before sending outreach
Clean your lists with 98.5% accuracy, catch-all resolution, and 1,000 free credits.
