SPF flattening is the practice of rewriting an SPF record so that mechanisms requiring DNS lookups (chiefly include, a, mx and redirect) are resolved into the underlying IP addresses and published directly as ip4 and ip6 mechanisms.
It exists because SPF (RFC 7208) permits at most 10 DNS lookups when evaluating a record. Each include for a provider such as a CRM, helpdesk or marketing platform can add several lookups, and large senders quickly exceed the cap, producing a permerror that causes receivers to ignore SPF entirely. Flattening collapses those nested lookups to zero, keeping the record valid.
The trade-off is maintenance. Providers change their sending IPs without warning, and a flattened record becomes stale the moment they do, silently failing legitimate mail. Flattening should therefore be automated and re-resolved on a schedule, never done once by hand. It can also bump up against SPF's 255-character-per-string and total record-length limits.
Check your lookup count with an SPF analyser first. Prefer trimming unused includes before flattening; DMARC Engine flattens and refreshes records automatically so they never drift out of date.
Check it on your domain
- SPF Checker: validates SPF and counts DNS lookups against the limit of 10.
- SPF Generator: generates an SPF record from your list of senders.
- DNS Record Checker: looks up any DNS record type for a host.