# SPF flattener

> Turns an SPF record's includes into IP addresses to get under the 10-lookup limit. Free, no signup. We look this up and don't keep it.

**SPF flattener. An SPF record under 10 lookups, no signup.** Use it at https://tools.joinvalley.co/spf-flattener

## What counts toward SPF's 10-lookup limit? RFC 7208's rules, term by term.

Every include, a, mx, ptr and exists mechanism, and the redirect modifier, costs one DNS lookup, and RFC 7208 caps them at 10 per check; past that, receivers return a permanent error. ip4, ip6 and all cost nothing, which is why flattening includes into IP addresses brings the count down.

| Term | Costs a lookup? | When flattened |
| --- | --- | --- |
| include: | Yes, plus every lookup inside it | Replaced by the IPs behind it, or kept |
| a, mx | Yes | Replaced by the addresses they resolve to |
| redirect= | Yes | Replaced by the target record's IPs |
| ptr, exists | Yes | Kept as written: they can't become fixed addresses |
| ip4:, ip6: | No | Kept |
| all | No | Kept, with its qualifier |

RFC 7208 also limits void lookups, ones that find no record, to two.

Sources: [RFC 7208: Sender Policy Framework (SPF), §3.3, §3.4 and §4.6.4](https://www.rfc-editor.org/rfc/rfc7208) (read 2026-11-17)

## How it works

Type a domain. Our server reads its SPF record and follows every include, redirect, a and mx term down the tree, at most 40 lookups, resolving a and mx terms to addresses. Your browser then builds the flattened record: the domain's own IPs, each include either replaced by the IPs behind it or kept as it is, and the original all.

It counts lookups before and after, splits a record longer than 255 characters into quoted strings (RFC 7208 joins them back together), and warns past 450 octets. Microsoft 365's include is kept by default, because Microsoft says not to flatten it.

What it can't do is keep the record current. A flattened record copies today's addresses; when a provider changes them, the record goes stale until you flatten it again. We don't change your DNS or keep your domain.

## Flatten SPF without breaking mail. Fewer lookups, and the includes you shouldn't touch.

Every tool you send from adds an include. Here's how to get under the limit without losing mail.

### Why the limit bites

RFC 7208 caps the DNS-querying terms in one SPF check at 10, counting includes inside includes, and says a receiver must return a permanent error past that. Microsoft notes that fewer than 10 include: statements doesn't guarantee fewer than 10 lookups, because each include can contain more.

Sources: [RFC 7208: Sender Policy Framework (SPF), §3.3, §3.4 and §4.6.4](https://www.rfc-editor.org/rfc/rfc7208) (read 2026-11-17), [Microsoft Learn: Set up SPF to identify valid email sources for your Microsoft 365 domain](https://learn.microsoft.com/en-us/defender-office-365/email-authentication-spf-configure) (read 2026-11-17)

### Keep the big providers as includes

Microsoft's guide says not to flatten Microsoft 365's include, because its sending infrastructure uses dynamic IP addresses that change frequently, and to review any flattened entries at least quarterly. Google's setup page gives v=spf1 include:_spf.google.com ~all for Google Workspace. Flatten the small, stable senders first, and keep includes for providers whose addresses move.

Sources: [Microsoft Learn: Set up SPF to identify valid email sources for your Microsoft 365 domain](https://learn.microsoft.com/en-us/defender-office-365/email-authentication-spf-configure) (read 2026-11-17), [Google Workspace Admin Help: Set up SPF](https://knowledge.workspace.google.com/admin/security/set-up-spf) (read 2026-11-17)

### Long records, and the 512-octet line

A TXT string holds 255 characters, so a longer SPF record is published as several strings in one record, which RFC 7208 says receivers join together without spaces. The RFC also says the record should stay small enough for the DNS answer to fit in 512 octets, and that answers under 450 octets ought to fit in a UDP packet.

A record under 10 lookups gets your mail authenticated. Getting it answered is a different job. [Valley](https://www.joinvalley.co/?utm_source=tools_suite)

Sources: [RFC 7208: Sender Policy Framework (SPF), §3.3, §3.4 and §4.6.4](https://www.rfc-editor.org/rfc/rfc7208) (read 2026-11-17)

## Sources

- [RFC 7208: Sender Policy Framework (SPF), §3.3, §3.4 and §4.6.4](https://www.rfc-editor.org/rfc/rfc7208) (read 2026-11-17)
- [Microsoft Learn: Set up SPF to identify valid email sources for your Microsoft 365 domain](https://learn.microsoft.com/en-us/defender-office-365/email-authentication-spf-configure) (read 2026-11-17)
- [Google Workspace Admin Help: Set up SPF](https://knowledge.workspace.google.com/admin/security/set-up-spf) (read 2026-11-17)

## Questions people ask

### What is SPF flattening?

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

### What is the SPF 10 lookup limit?

RFC 7208 allows at most 10 DNS-querying terms (include, a, mx, ptr, exists and redirect) in one SPF check; past that, receivers return a permanent error.

### Do ip4 and ip6 count toward the SPF lookup limit?

No. ip4, ip6 and all cost no DNS lookup, which is why flattening includes into IPs lowers the count.

### Should I flatten Microsoft 365's SPF include?

No. Microsoft says not to flatten include:spf.protection.outlook.com, because its sending IP addresses change frequently.

### How long can an SPF record be?

Each TXT string holds 255 characters, and longer records use several strings that receivers join. RFC 7208 asks for the answer to fit in 512 octets.

### How often should I re-flatten SPF?

Whenever a provider changes its addresses. Microsoft says to review flattened entries at least quarterly.

### Is this SPF flattener free?

Yes. It's free and needs no signup. We look up the domain you type and don't keep it.

## Related tools

- [SPF record generator](https://tools.joinvalley.co/spf-record-generator): Builds an SPF record and counts every DNS lookup, nested includes too, against 10.
- [SPF, DKIM and DMARC checker](https://tools.joinvalley.co/spf-dkim-dmarc-checker): Checks a domain's SPF, DKIM and DMARC records against Gmail and Yahoo's sender rules.
- [DNS lookup](https://tools.joinvalley.co/dns-lookup): Every common DNS record for a domain, from Cloudflare and Google side by side.
- [DMARC report reader](https://tools.joinvalley.co/dmarc-report-reader): Reads a DMARC aggregate report: who sends as your domain, and why each one fails.
- [Cold email domain finder](https://tools.joinvalley.co/cold-email-domain-finder): Sending domain ideas close to your brand, each checked against its registry.

## Next step

Want replies, not just clean copy? Valley finds buyers showing real buying signals and messages them across email and LinkedIn. [Valley](https://www.joinvalley.co/?utm_source=tools_suite)

Shelf: [04 Email outreach](https://tools.joinvalley.co/email-outreach)

---

Tools by Valley, made by [Valley](https://www.joinvalley.co/?utm_source=tools_suite). HTML version: https://tools.joinvalley.co/spf-flattener
