What is SPF flattening and how does it help?

Still have a question, spotted an error, or have a better explanation or a source we should cite?

You've got your SPF record set up with multiple include statements, and everything's working fine. So why do you keep hearing about flattening? The reason comes down to a hard limit that catches a lot of senders by surprise.

The problem with includes

Every include statement in your SPF record triggers a DNS lookup. Google's SPF include adds one lookup, SendGrid's adds another, Mailchimp's adds another. You can stack up to 10 DNS lookups before you hit the limit and your SPF authentication breaks. That's why flattening matters.

What flattening actually does

Instead of having your SPF record say "trust the IPs that Google publishes," flattening means you copy Google's actual IP addresses directly into your own record. Now instead of triggering a DNS lookup, your SPF result comes back immediately. Zero lookups from that entry, zero risk of hitting the limit.

When you'd flatten

Still if you've got 8 or 9 includes, you're close to the edge. If you've got more than that, you're probably already broken and don't know it. Even if you're not at the limit yet, flattening gives you breathing room as you add new sending services.

The trade-offs to know

Here's the catch: when Google updates their IP addresses, your flattened record becomes outdated. You have to update it manually, which means you need a process for monitoring those changes. Manual flattening is error-prone and tedious (of course, easier said than done). Some teams use automated flattening services that handle updates for you, turning this from a manual nightmare into a set-and-forget solution. Your record also gets much longer and uglier to read, but that's a small price.

Start by checking how many DNS lookups you're using right now. If you're at 7 or higher, flattening or consolidating your sending services should be on your to-do list. Not sure where you stand? Check your SPF lookup count with our free SPF checker before planning your next move.

Contributors

Who worked on this answer

Every name links to their profile. Every company links to their site. Real people, real accountability.

Ask an AI · tailored to your setup

Decide if SPF flattening makes sense for your setup.

I've got number SPF includes in my record and I'm wondering if I should flatten. Can you help me figure out if I'm in danger of hitting the lookup limit, what flattening would actually look like for my setup, and whether the maintenance burden is worth it compared to just consolidating my sending services instead?

Edit the yellow boxes, then send to the AI of your choice.