Skip to content
Sign inStart monitoring

Network Diagnostic · SPF-FLATTEN

SPF Flattener Diagnostic & Telemetry Engine

Flatten SPF includes under the lookup limit. Direct edge diagnostics with zero caching and sub-second global resolution.

IETF Standards Track12 Anycast POPsZero CachingSub-50ms Latency
Quick inspect:
Anycast live

Protocol specsIETF

Validated against standard IETF protocol specifications.

  • Direct Edge Execution
  • Zero Intermediary Caching
  • Sub-50ms Global Query
  • RFC Compliant Output

Edge POP routing12 active

Multi-region edge execution via anycast routing.

SGP (Singapore)Edge node
SJC (San Jose)Edge node
FRA (Frankfurt)Edge node
LHR (London)Edge node

Remediation adviceRFC best practice

Actionable configuration guidance for infrastructure.

Inspect the live output below and verify all protocol headers align with recommended standards.

Workflow & Diagnostics

How SPF Flattener works

RFC 7208 limits SPF evaluation to 10 DNS lookups. Exceeding this limit causes mailbox providers (Google, Yahoo, Microsoft) to reject mail with PermError. This tool flattens includes into direct IP ranges.

1

Enter your sending domain.

2

View current lookup count vs 10-lookup limit.

3

Copy optimized flattened TXT record to publish.

Troubleshooting & Remediation

How to Read & Fix Results

How to read the result

  • ProblemSPF exceeds the RFC 7208 Section 4.6.4 ceiling of 10 DNS lookups (triggers PermError) or publishes multiple v=spf1 TXT records at the apex.
  • WarningSPF sits at 8–10 lookups (one provider nested include away from PermError) or relies on static flattened CIDRs that require scheduled refreshes.
  • PassSingle v=spf1 TXT record strictly at <= 10 DNS lookups (or flattened to 0 lookups within DNS TXT size limits), ending with ~all or -all.

How to fix issues

  • Remove decommissioned ESPs, old helpdesks, and unused include: mechanisms first—pruning obsolete senders is safer than flattening.
  • Replace your existing apex v=spf1 TXT record with the consolidated flattened record (never publish a second v=spf1 record alongside it).
  • If any TXT record string exceeds 255 octets, split it into adjacent quoted chunks per RFC 7208 Section 3.3 and keep UDP DNS responses compact.
  • Move bulk marketing or transactional tools onto dedicated subdomains (e.g. mail.example.com) so vendor IP changes do not break apex SPF.

Common mistakes to avoid

  • Statically flattening fast-changing cloud ESPs and forgetting to refresh IP ranges when the vendor expands netblocks.
  • Creating a second v=spf1 TXT record instead of editing the original, causing immediate PermError across receivers.
  • Using the deprecated ptr mechanism (RFC 7208 Section 5.5) or chaining redundant a and mx lookups.
  • Exceeding the 2-void-lookup limit (RFC 7208 Section 4.6.4) via defunct include domains returning NXDOMAIN.

Flattened SPF Record (0 DNS Lookups)

RFC Syntax
Reference ExampleRFC 1035 / BIND
example.com.  300  IN  TXT  "v=spf1 ip4:198.51.100.0/24 ip4:203.0.113.10 ip6:2001:db8::/48 ~all"

Recursively resolves include: and redirect= chains up to depth 10 via public DoH resolvers, counts DNS-querying mechanisms against RFC 7208 limits, and consolidates ip4:/ip6: ranges. Static flattened IPs are a point-in-time snapshot.

Next checks:Inspect full SPF treeCheck DMARC policyEmail health scorecard

Specifications & Scope

About SPF Flattener

01 / What it does
RFC 7208 limits SPF evaluation to 10 DNS lookups. Exceeding this limit causes mailbox providers (Google, Yahoo, Microsoft) to reject mail with PermError. This tool flattens includes into direct IP ranges.
02 / How to use
1. Enter your sending domain. 2. View current lookup count vs 10-lookup limit. 3. Copy optimized flattened TXT record to publish.
03 / Good to know
Flattening eliminates lookup overhead, but you should re-run the flattener if your mail service providers (e.g. SendGrid, Google) update their sending IP ranges.

Got Questions?

Frequently Asked Questions

RFC 7208 Section 4.6.4 dictates that email receivers must abort SPF evaluation if it triggers more than 10 DNS queries across include, a, mx, ptr, and exists mechanisms.
Technical Reference & Standards

Tool Details & Usage Guide

RFC specifications, input expectations, outputs, and edge limitations.

RFC 7208 Lookup Limits Explained

Sender Policy Framework (RFC 7208) prevents unauthorized servers from forging your domain in the SMTP MAIL FROM (envelope sender) header. To shield receiving mail servers from amplification loops and slow recursive DNS chains, RFC 7208 Section 4.6.4 enforces two strict runtime ceilings during SPF evaluation:

  1. Maximum 10 DNS-Querying Mechanisms: Every include:, a, mx, ptr, exists:, and redirect= mechanism (including nested evaluations inside third-party include: chains) increments a global lookup counter. On the 11th DNS lookup, receivers MUST abort evaluation with PermError.
  2. Maximum 2 Void Lookups: A void lookup occurs when a DNS query returns NXDOMAIN (domain does not exist) or NOERROR with zero answer records. Exceeding 2 void lookups also triggers PermError.

Static mechanisms (ip4:, ip6:, all) and modifiers like exp= do not consume any DNS lookups.


PermError vs. TempError & DMARC Impact

Understanding the difference between SPF failure modes prevents misdiagnosing inbox drops:

  • PermError (Permanent Error): Caused by exceeding 10 DNS lookups, exceeding 2 void lookups, publishing more than one v=spf1 TXT record at the apex (RFC 7208 Section 3.2), or syntax errors. DMARC (RFC 7489) evaluates SPF PermError as authentication fail. If DKIM alignment is missing or fails on forwarded mail, messages bounce (550 5.7.1) or land in spam.
  • TempError (Transient Error): Caused by DNS timeouts or SERVFAIL responses from your authoritative nameservers. Compliant MTAs typically return a 4xx temporary deferral and retry later rather than permanently rejecting the message.

Counted, not estimated: two of the biggest domains on the internet sit at exactly 10

Most explanations of the lookup limit invent an example stack and assign it plausible numbers. Instead, here are real records, counted recursively on 27 November 2026 under the RFC 7208 §4.6.4 rule: every include:, a, mx, ptr, exists: and redirect= costs 1, plus whatever the record it points to costs; ip4:, ip6: and all cost 0.

github.com — 10 of 10. GitHub authorizes its own servers with ip4: ranges (free) and then stacks eight vendors on top:

Term in github.com’s record Lookups it costs Why
include:spf.protection.outlook.com 1 Microsoft’s record is a flat list of IP ranges — 0 nested terms
include:_netblocks.google.com 1 IP ranges only — 0 nested terms
include:_netblocks2.google.com 1 IP ranges only — 0 nested terms
include:mail.zendesk.com 1 Flat IP list — 0 nested terms
include:_spf.salesforce.com 2 Its record contains an exists: lookup of its own
include:servers.mcsv.net (Mailchimp) 1 Flat IP list — 0 nested terms
include:mktomail.com (Marketo) 1 0 nested terms when counted
include:sendgrid.net 2 Its record includes ab.sendgrid.net in turn
Total 10 One more vendor include and github.com PermErrors

oracle.com — also exactly 10, reached a different way: six includes (spf_s, spf_r, spf_c, spf_x, spf_z.oracle.com and stspg-customer.com), four of which nest further terms of their own.

And the counter-examples, counted the same day: microsoft.com uses 6 (four includes, two of which nest one more term each), and google.com uses exactly 1 — its only term is include:_spf.google.com, and that record is nothing but ip4:/ip6: ranges. The lesson cuts both ways. The limit is not a big-company problem or a small-company problem; it is a stacking problem. Google proves a giant sender can run at 1. GitHub and Oracle prove how eight ordinary vendor decisions — an ESP here, a helpdesk there, a CRM nobody told IT about — add up to the ceiling with zero headroom for the next tool someone signs up for.

Three operational details the real counts expose:

  • You cannot price an include from the top-level record. Some vendor includes are flat IP lists and cost the minimum 1 forever. Others hide exists: or further include: terms and cost 2+. The only way to know is to resolve the whole chain — which is what the flattener above does mechanically.
  • Microsoft flattened its own house. spf.protection.outlook.com — the include that millions of customer domains pay lookups for — resolves to a flat list of IP ranges with no nested terms at all. That is the static-flattening strategy from the table below, practised by the vendor itself, on the record its customers depend on.
  • 9 is already broken. If your count is 9 or 10, you do not control when it becomes 11 — a vendor adding one nested term to their record does it for you, silently, and your first symptom is receivers returning PermError on mail you didn’t change.

Count your own record in two minutes: run it through the SPF checker, which walks the chain for you — or by hand: write down every include:/a/mx/exists:/redirect= term, fetch each include target’s record, count its terms too, and recurse until every branch ends in ip4:/ip6:/all:

dig +short TXT example.com | grep -i "v=spf1"
dig +short TXT _spf.google.com

Static vs. Dynamic Flattening & Architectural Alternatives

The SPF Flattener recursively traverses include: and redirect= chains (up to depth 10) and consolidates discovered ip4: and ip6: networks into a single record requiring 0 DNS lookups. Before publishing a flattened TXT record, weigh the operational trade-offs:

Strategy DNS Lookups Maintenance Risk DNS Packet / TXT Constraints
Prune unused includes Reduced Zero drift Always step 1: remove decommissioned vendors
Dedicated subdomains 1–4 per subdomain Very low Move SendGrid/HubSpot to mail.example.com with own SPF + DKIM
Static flattening 0 lookups Medium (IP rotation drift) Cloud ESPs expand CIDRs; must re-flatten periodically
Dynamic scheduled flattening 0–1 lookups Low (automated sync) Requires API automation against Cloudflare/Route 53

Critical DNS TXT edge cases when flattening:

  • 255-Octet String Limit (RFC 7208 Section 3.3): Individual character-strings inside a TXT record cannot exceed 255 bytes. Long flattened SPF records must be split into multiple adjacent quoted strings ("v=spf1 ip4:... " "ip4:... ~all"), which receivers concatenate automatically.
  • UDP 512-Byte Response Size: Very large CIDR lists bloat UDP DNS replies beyond 512 bytes, forcing TCP fallback and risking timeouts on legacy mail relays. If your flattened list exceeds ~20–25 CIDR blocks, subdomaining high-volume ESPs (bounce.example.com, em.example.com) is cleaner and avoids CIDR drift completely.
  • Single Record Rule: Replace your existing apex v=spf1 record; never add a second v=spf1 TXT record alongside it.

Validate your updated record with the SPF Checker, build new vendor policies with the SPF Generator, enforce alignment via DMARC Analyzer and DMARC Generator, and verify end-to-end compliance on Email Health.