SPF flattening tool: replace includes with IP addresses
SPF flattening replaces the include, a and mx mechanisms in an SPF record with the ip4 and ip6 addresses they resolve to, so the record costs fewer of the 10 DNS lookups SPF allows. Enter a domain above to get the flattened record. It's a snapshot: when a provider changes its sending IPs, the flattened record goes out of date.
Sample result
acme.example's SPF record flattened from 2 lookups down to 0.
- Flattened record
- acme.example
- Lookups
- 2 down to 0
- ip4 terms
- 2
What this means for you
Fewer lookups avoids SPF errors, but provider IPs change, so re-flatten regularly.
- Resolves include, a and mx to ip4 and ip6
- Splits long records into _spfN sub-records
- Keep chosen includes as they are
- Warns the ranges change without notice
- SPF
- Flatten
- ip4
By SimpleVerifier Team · Last updated
How do I flatten an SPF record?
- Enter your domain, or an email address at it, and press Flatten SPF.
- Compare the lookup counts: your current record's, and the flattened one's.
- Untick any include you'd rather keep as an include, such as a provider that changes its IPs often; the record rebuilds without flattening it.
- Copy the record, or the main record and its _spf sub-records if it's over 450 bytes, into your DNS host as TXT records. Set a reminder to re-run it.
Example
- You enter
- The domain
acme.example, whose SPF record isv=spf1 include:_spf.acme-mail.example mx ~all. - You get
- The flattened record
v=spf1 ip4:192.0.2.0/24 ip4:203.0.113.25 ~all: 45 bytes, lookups down from 2 to 0. It's a snapshot of today's IPs, so it needs re-running when a provider changes its ranges. - Limits
- One domain per run and 10 runs a minute per connection.
What is SPF flattening?
SPF flattening is rewriting an SPF record so that it lists IP addresses directly instead of pointing to other records. Each include, a, mx, ptr, exists and redirect costs one DNS lookup, including those nested inside includes, and RFC 7208 caps a check at 10. Over that, SPF returns permerror and the check fails. ip4 and ip6 cost nothing.
A domain that sends through Google Workspace, Microsoft 365, a CRM, a help desk and a marketing platform can pass 10 lookups without any single include looking heavy. The SPF lookup counter shows where yours are spent; this tool removes them.
How does SPF flattening work?
The tool expands the record the way a receiving server does, then replaces each passing include with the ip4 and ip6 terms inside it, and each a or mx with the addresses those names resolve to. Terms that can't be replaced without changing the result are kept as written: exists and anything with a macro, which receivers expand per message, and includes with a -, ~ or ? qualifier.
Inside an include only passing terms count, so a -ip4 inside an included record never makes the include match. Those are dropped from the flattened copy, with a note, because copying them across would change how your own record evaluates.
Why does a flattened SPF record go out of date?
Because the includes you replaced are maintained by the providers, and a flattened record is a copy. When Google, Microsoft or a marketing platform adds a sending range to its own SPF record, everyone who includes it picks the change up on the next lookup; a flattened record doesn't. Mail from the new range then fails SPF, and with a strict DMARC policy it can be rejected.
That's why the tool lets you keep chosen includes and flatten the rest. Flatten records you control or that rarely change, keep the large providers' includes if the count allows, and re-run the tool on a schedule. Paid flattening services do the re-run for you; that's the part a one-off flattening can't do.
What if the flattened record is too long?
RFC 7208 section 3.4 asks that an SPF answer stay under 450 octets so it fits a 512-byte UDP DNS response, and a single TXT string can't be longer than 255 characters. When the flattened record is over 450 bytes, the tool splits the addresses into sub-records at _spf1.yourdomain, _spf2.yourdomain and so on, and gives you a main record that includes them: one lookup per sub-record.
Under 450 bytes but over 255, the record is shown as one line and as quoted 255-character strings. Most DNS hosts split long TXT values for you; some ask you to paste the quoted form.
Flatten the record, or remove senders?
| Flattening | Removing unused includes | |
|---|---|---|
| Lookups saved | Up to all of them | One or more per include removed |
| Keeps every sender passing | Yes, until a provider's IPs change | Only the ones you keep |
| Maintenance | Re-run when providers change | None |
| Best for | Many active senders | Senders you no longer use |
Who uses this tool, and for what?
- IT admins
- Fix a permerror after adding one sending service too many, without dropping a provider from SPF.
- Agencies
- Show a client which includes cost the most lookups and hand over a flattened record, or a partial one that keeps the big providers.
- Cold emailers
- Get a sending domain's SPF to pass before warm-up, when its record pulls in several sending platforms.
- Developers
- See exactly which IP ranges a domain's SPF allows, flattened into one list.
What can’t this tool tell you?
- The result is a snapshot of today's IPs. It does not update itself; providers' ranges change.
- exists, ptr and macro terms can't be flattened and still cost lookups.
- a and mx terms with an IPv6 prefix length (//64) are kept as written.
- Adjacent ranges aren't merged, so the record can be longer than a hand-tuned one.
Common questions
- What is SPF flattening?
- Replacing the includes, a and mx terms in an SPF record with the IP addresses they resolve to, so the record uses fewer of the 10 DNS lookups SPF allows.
- How does SPF flattening work?
- The tool expands every include the way a receiving server would, collects the ip4 and ip6 ranges, and writes them into one record. Terms that would change meaning if replaced, like exists and macros, stay as they are.
- What is SPF flattening used for?
- Fixing the SPF permerror "too many DNS lookups", which makes SPF fail for every message once a record needs more than 10 lookups.
- How to flatten an SPF record?
- Enter the domain above, copy the flattened record, and replace the existing SPF TXT record at your DNS host with it. Publish only one SPF record per domain.
- Can I have multiple SPF records?
- No. RFC 7208 makes two v=spf1 records on one name a permerror. The _spf1 and _spf2 sub-records this tool makes are on different names, included from the one main record.
- Is an SPF record necessary?
- For anyone sending to Gmail, in practice yes: Google's sender guidelines require SPF or DKIM from every sender and both from bulk senders. A flattened record counts as SPF like any other.
Sources
You audited one domain. Cold outreach means thousands.
This tool checks a domain you type in. It will not tell you which addresses at that domain are real.
- Bulk mailbox verification with real SMTP checks
- The email finder — name plus company to a verified address
- Website enrichment for emails, owner names and socials
One plan, cancel anytime, no contract. Sign in with Google and your first 100 email checks are free, no card. The free tools stay free either way.