Free tool

SPF flattening tool: fix too many DNS lookups

SPF flattening replaces include: terms in an SPF record with the IP addresses they resolve to, so the record needs fewer DNS lookups.

The record and every include are read from your browser through Cloudflare's public DNS resolver. Nothing is stored.

About this tool

About the SPF flattening tool

SPF allows 10; above that it fails with permerror for every message. Enter your domain: the tool counts what each include costs, flattens the heaviest until the record fits and gives you the records to publish.

It also merges a domain's multiple SPF records into one. The addresses are a snapshot of today, so run it again every month and after you add a service.

How it works

How the flattening works

  • Every include, a, mx, ptr, exists and redirect costs a lookup, and so does every one nested inside an include; the tool walks the tree and shows each branch's total
  • The heaviest includes are ticked until the record is at 9 lookups or fewer, one spare for the next service; tick or untick any of them
  • A ticked include becomes ip4: and ip6: terms for every address it resolves to now, with duplicates and ranges inside other ranges removed
  • Up to 450 characters the addresses stay in one record; above that they move to _spf1.yourdomain.com, _spf2.yourdomain.com, each pulled in by one include and costing one lookup
  • Includes that use exists:, ptr or macros, or point at a broken record, cannot be flattened and stay as they are
  • Two or more SPF records on the domain are merged into one; publish the result and delete the old records in the same edit

Background

What flattening costs you

A flattened record is a copy. When a provider adds or moves servers, mail from the new ones fails SPF until you flatten again, and nothing tells you it happened. Large providers such as Google Workspace and Microsoft 365 cost one lookup each, so flattening them saves little and carries the most change; the tool leaves one-lookup includes alone.

Hosted flattening services re-flatten for you, through an include on their domain that your SPF then depends on. This tool gives you plain records with no dependency on us, so put a monthly reminder next to them.

Background

Fix too many lookups without flattening

  • Remove includes for services you stopped using; old CRMs, helpdesks and newsletter tools are the usual ones
  • Drop includes for services that carry SPF on their own return-path: SendGrid with automated security, Amazon SES with the default MAIL FROM, Postmark, Mailchimp and Mandrill (which services need one)
  • Replace a and mx with the ip4 addresses of your own servers, and delete ptr
  • Move a sending service to its own subdomain, such as mail.yourdomain.com, with its own SPF record and its own 10 lookups
  • Cold email domains: keep them separate from the domain your team uses, with one mailbox provider in SPF; domains for cold email covers the setup
  • Then check the live record with the SPF, DKIM and DMARC checker; the permerror fixes are in fixing SPF permerror
  • Check the published record and its include tree with the SPF checker

Free guide19 min read

Send 100,000 cold emails a month

Domains and mailboxes you need, DNS, warm-up, lists, copy and follow-ups, with a launch checklist, sent to your inbox.

Unsubscribe in one click.

Questions

What happens if my SPF record exceeds 10 lookups?

The SPF check stops with permerror and SPF fails for every message from the domain, including mail from listed services. DMARC then passes only where DKIM is aligned, and receivers that check SPF on its own may reject the mail.

Can I have two SPF records on the same domain?

No. Receivers return permerror when they find more than one v=spf1 record. Merge them: the tool above reads both and builds one record.

Should I flatten Google Workspace or Microsoft 365 includes?

Usually not. Each costs one lookup today, so flattening saves one lookup and leaves you to track their address changes. Flatten the services whose includes nest several others.

How often do I need to re-flatten my SPF record?

Run the tool again every month and whenever you add or change a sending service. A provider that adds servers does not tell you; mail from those servers fails SPF until the record is updated.

What is the difference between SPF flattening and hosted SPF?

Flattening writes the addresses into your own DNS once. Hosted SPF replaces your includes with one include on the vendor's domain, which the vendor keeps up to date; your SPF then depends on that vendor.

Is there a free SPF flattening tool?

Yes, this one. It runs in your browser, needs no sign-up and gives you plain TXT records with no include on our domain.

In your AI assistant

Run the same checks in Claude or ChatGPT

Free SKILL.md files with the rules behind this tool. Install them in Claude or Claude Code, or paste them into ChatGPT, Gemini, Grok or Cursor.

Mailboxes, warm-up and sending in one place

$2.50 a mailbox a month. DNS records are set for you, and every mailbox shows its warm-up numbers from day one.

Deliverability call

Talk to our deliverability team

Book a call with the people who run our mailbox infrastructure. We look at your current setup and tell you what to change. Running 1,000+ mailboxes? We also quote a volume price below every vendor list price in our comparisons, warm-up and sending included.

  • Review your domains, DNS records and current inbox placement
  • Size the setup: domains, mailboxes per domain and daily volume per mailbox
  • Plan warm-up and the move from your current provider or sequencer
  • 1,000+ mailboxes: a volume price per mailbox for your setup

Free call

See open times in your time zone and book on this page.

Or open the booking page