SPF flattening: What is it and why do you need it?

by

Last Updated:
10 min read
SPF flattening: What is it and why do you need it?

SPF or Sender Policy Framework is an email authentication protocol that is critical in the process of preventing spoofing attacks. SPF works by specifying senders (mail servers) that are authorized to send emails on behalf of an organization’s domain.

However, SPF comes with a unique limitation: it has a DNS lookup limit of 10 queries as mentioned under section 4.6.4 of RFC 7208. SPF records that exceed this lookup limit break and return a permanent error (PermError). This is where SPF flattening comes into play as an effective solution to resolve this limitation.

Who Needs SPF Flattening Most?

  • Enterprises managing 5+ domains
  • MSPs/MSSPs supporting multiple client tenants
  • Organizations sending 100,000+ emails per month
  • Compliance-driven businesses (finance, healthcare, government)

Key Takeaways

  1. SPF is essential for preventing email spoofing by authorizing specific mail servers to send emails on behalf of a domain.
  2. SPF records must comply with a DNS lookup limit of 10 queries, and exceeding this limit results in errors.
  3. SPF flattening simplifies DNS records to stay within the lookup limit, enhancing email deliverability and compliance.
  4. Regular monitoring and updating of SPF records are crucial to accommodate changes made by email service providers.
  5. Using automated tools for SPF flattening offers a reliable and efficient way to manage and optimize SPF records.
  6. With DMARCbis now officially published as RFC 9989, 9990, and 9991 (May 2026), maintaining proper SPF configuration is more important than ever for DMARC alignment and compliance.

What is SPF Flattening? 

SPF flattening simplifies and optimizes your SPF DNS record. This reduces the number of DNS lookups it generates, ensuring domain owners stay within the allowed DNS query limit. It does so by consolidating nested includes and replacing indirect references with corresponding IPs, transforming the record into a single, comprehensive entity for error-free SPF authentication. 

Example:

Before Flattening: v=spf1 include:example1.com include:example2.com ~all

After Flattening: v=spf1 ip4:192.168.1.1 ip4:192.168.2.2 ~all

Flattening SPF records replaces the “include” mechanisms with direct IP addresses, minimizing DNS lookups.

When Should You Use SPF Flattening?

SPF flattening is most beneficial in specific scenarios where traditional SPF records become problematic. Understanding when to apply this technique helps you make informed decisions about your email authentication strategy.

Ideal Scenarios for SPF Flattening:

  • Exceeding DNS Lookup Limits: When your SPF record requires more than 10 DNS lookups.
  • Complex Sender Setups: Organizations using 5+ third-party email services (marketing, transactional, support).
  • High-Volume Email Operations: Enterprises sending 100,000+ emails monthly across multiple platforms.
  • Compliance Requirements: Regulated industries needing strict email authentication controls — especially with Google, Yahoo, and Microsoft now actively rejecting non-compliant bulk sender emails.

When NOT to Use SPF Flattening:

  • Simple Email Setups: Organizations with fewer than 3 email services.
  • Frequently Changing Providers: If you regularly switch email service providers (manual flattening becomes a liability as provider IPs rotate frequently—for example, Google rotated their _netblocks multiple times in 2025 alone).
  • Limited Technical Resources: Without proper monitoring and maintenance capabilities.

Why is SPF Flattening Essential?

Simplifying SPF records by using optimization techniques like Flattening offers several benefits: 

1. Maintaining Compliance

It is mandatory for SPF records to adhere to DNS lookup limits. Flattening helps simplify SPF records to stay under the limit, thereby maintaining compliance with RFC-specified regulations for email authentication protocols documented by the IETF. With DMARCbis now formalized as RFC 9989, 9990, and 9991 (published May 2026), the standards around email authentication have become even more rigorous. A properly maintained SPF record is foundational to passing both SPF and 

DMARC alignment checks. This compliance ensures that your domain remains trustworthy in the eyes of email-receiving mail servers.

2. Improved Email Deliverability

Emails that exceed the SPF lookup limit are often treated with suspicion and may get flagged or even rejected by the receiver’s mail server. This will lead to email deliverability issues. SPF flattening ensures that your SPF stays within the permitted limit, thereby making your emails appear more legitimate and resolving deliverability issues. 

This is especially critical as of 2025–2026, with Google actively rejecting emails that fail authentication, and Microsoft enforcing similar bulk sender rules including mandatory SPF, DKIM, and DMARC.

3. Reduced Risk of Email Spoofing

Pairing SPF with DMARC, while also using flattening to optimize SPF, reduces the risk of email-based cyber attacks like phishing and spoofing. If your DMARC implementation is paired with SPF that exceeds the allowed limit, failing SPF will also result in DMARC failures for even legitimate messages.

According to recent industry data, DMARC adoption reached over 937,000 domains by early 2026, but enforcement-level policies (quarantine or reject) still lag behind at roughly 412,000. Proper SPF management through flattening helps close this gap by ensuring SPF passes reliably before DMARC evaluates alignment.

How SPF Flattening Works

You can flatten SPF manually, or choose an automated online tool to fast-track the method. Let’s explore both: 

Manual SPF Flattening

To manually flatten your SPF records: 

Step 1. Analyze SPF Records: Identify all includes and nested lookups.

Step 2. Consolidate Lookups: Replace includes with direct IP addresses or CIDR ranges.

Step 3. Test the Flattened Record: Validate your flattened SPF record by either manually reviewing the record in your DNS, or using an online SPF checker tool to ensure compliance and functionality.

Automated SPF Flattening

You can auto-flatten your SPF records using PowerDMARC’s SPF flattening tool. Here’s how it works: 

Step 1: Sign up on the PowerDMARC platform.

SPF flattening

Step 2: Click on PowerSPF under “Hosted Services”. 

SPF flattening

Step 3: Add your domain and select the active domain.

SPF flattening

SPF flattening

Step 4: Click on “Automated Setup” and Enable PowerSPF.

SPF flattening

Note: Manual SPF flattening is not recommended as email service providers often add or change their IP addresses without notifying users. Users need to always stay on top of these services to stay informed on any changes. Unless they do so, it may lead to unwanted SPF failures and cause your legitimate emails to not get delivered. This makes automatic flattening a hassle-free method and a clear winner in terms of both reliability and effectiveness. 

Why PowerDMARC for SPF Flattening?

  • Unified Dashboard: Manage SPF, DKIM, DMARC, MTA-STS, and BIMI from a single platform.
  • Compliance-Ready: Designed for regulated industries with full audit trails.
  • SPF Macros Support: PowerDMARC is one of the few platforms offering hosted SPF macros as part of PowerSPF—a more effective solution than traditional flattening with higher success rates.
  • Global 24/7 Support: Access our highly responsive expert team anytime, anywhere.
  • AWS & Azure Marketplace: Flexible deployment options for modern enterprises.
  • Scalable for Multi-Domain, Multi-Tenant Environments: Built for enterprise and MSP/MSSP needs.
  • Transparent Reporting: Real-time visibility into authentication status and deliverability.

Alternatives to SPF Flattening

While SPF flattening is effective, several alternative approaches can help you manage SPF record limitations without the maintenance overhead of traditional flattening.

1. SPF Macros

SPF macros use dynamic variables (%{i}, %{s}, %{h}) to resolve lookups at query time, keeping records shorter while maintaining functionality. This approach avoids the static IP limitations of traditional flattening.

2. Subdomain Delegation

Distribute email sending across subdomains (e.g., marketing.example.com, support.example.com) to reduce the complexity of your main domain’s SPF record. This approach is particularly effective for organizations managing DMARC across multiple domains.

3. Sender Consolidation

Reduce the number of third-party email services by consolidating similar functions under fewer providers, naturally reducing DNS lookup requirements.

MethodComplexityMaintenanceRiskBest For
SPF FlatteningMediumHighMediumStable environments
SPF MacrosHighLowLowDynamic environments
Subdomain DelegationLowMediumLowLarge organizations
Sender ConsolidationLowLowLowSmall to medium businesses

SPF Flattening Best Practices

To ensure the flattened SPF record is performing as it should, you can take the following tips into consideration:

1. Monitor Flattened SPF Records

SPF records are often subject to changes as they heavily depend on alterations made by your email service providers and vendors to their own IP addresses and sending servers. Flattened SPF records (especially ones that are manually flattened) may often get outdated—reintroducing lookup limitation errors. It’s important to schedule periodic reviews to check for any changes and update your SPF records accordingly using PowerDMARC’s automated tools, which proactively monitor and update your SPF records.

How Often Should You Update a Flattened SPF Record?

For manually flattened records, review and update monthly or whenever you add/remove email services. For automated solutions like PowerSPF, updates happen continuously without manual intervention. Industry best practice in 2026 suggests that automated tools should rescan upstream vendor IP ranges at least every 15 minutes to maintain reliable freshness. The risks of neglecting updates include mail delivery failures, authentication errors, and potential security vulnerabilities.

2. Simplify SPF Records

While flattening SPF records, you need to also keep in mind simplicity and manageability. Extensive and complicated SPF setups often introduce errors and complexities during authentication. As flattening replaces include mechanisms with IP addresses and ranges, sometimes the string may get long enough to exceed the permitted SPF length limit of 255 characters.

3. Use SPF Macros

A much more effective and reliable method that does away with the drawbacks of SPF flattening is Macros optimization. This method ensures lookup, void as well as length limits are not exceeded in almost all cases, with a much lesser failure rate in comparison to flattening.

Common Challenges with SPF Flattening

Let’s explore a few problems domain owners may face when using traditional flattening methods, and some easy fixes:

1. Managing Updates

Changes in authorized servers require updates to flattened records. A solution around this is to schedule regular audits and leverage PowerDMARC’s automated tools, which proactively monitor and update your SPF records.

2. Lengthy SPF Records

Replacing IP references with actual IPs may lead to very lengthy records that exceed the character length limit. A solution around this is to use Macros instead of flattening.

3. Misconfigured SPF Records

Misconfigured records can cause email disruptions. Rely on trusted SPF flattening tools or services that also offer expert support for assistance whenever needed.

Related reading: SPF Fail: What It Means and How to Fix It

Common SPF Flattening Mistakes to Avoid

Avoiding these frequent mistakes can save you from costly email delivery failures and security vulnerabilities:

1. Record Length Violations

Mistake: Creating flattened records that exceed the 255-character DNS TXT record limit.

Prevention: Use SPF macros or subdomain delegation for complex setups.

2. Failing to Update After Provider Changes

Mistake: Not monitoring when email service providers change their IP ranges.

Prevention: Implement automated monitoring or use PowerDMARC’s PowerSPF for continuous updates. Major providers like Google and Microsoft rotate their sending IP ranges regularly—a stale flattened record can silently de-authorize legitimate senders.

3. Improper Syntax in Flattened Records

Mistake: Introducing syntax errors when manually converting include statements to IP addresses.

Prevention: Always validate flattened records using SPF checker tools before deployment.

4. Over-Flattening Simple Records

Mistake: Flattening SPF records that don’t actually exceed the 10 DNS lookup limit.

Prevention: Analyze your current SPF record first to determine if flattening is necessary.

SPF Flattening vs. SPF Macros: A Quick Comparison

FeatureSPF FlatteningSPF Macros
DefinitionConverts all include mechanisms into direct IP addresses.Uses %{i}, %{s}, and %{h} macros to resolve SPF lookups dynamically.
PurposeReduces DNS lookups by replacing includes with IPs.Dynamically adjusts SPF lookups to avoid exceeding the 10 DNS lookup limit.
ProsReduces additional DNS lookups. Improves SPF record efficiency.Keeps SPF records shorter. Avoids excessive DNS lookups dynamically.
ConsRequires manual updates when IPs change. Can make SPF records too long.Can be complex to implement correctly without assistance.
Best suited forOrganizations with stable IPs and a need to reduce SPF lookups.Advanced users needing dynamic SPF solutions without static IP lists.

How DMARCbis (RFC 9989) Affects SPF Flattening in 2026

The publication of DMARCbis as official IETF standards (RFC 9989, 9990, and 9991) in May 2026 marks the most significant update to DMARC since its original release in 2015. While DMARCbis does not change the SPF lookup limit itself (which remains governed by RFC 7208), it tightens the requirements around how SPF results feed into DMARC alignment decisions.

Key implications for SPF flattening:

  • DMARCbis elevates DMARC from an informational RFC to a Proposed Standard, meaning stricter implementation requirements across the ecosystem.
  • SPF PermError still counts as a DMARC failure. Organizations relying on SPF for DMARC alignment cannot afford to exceed the 10-lookup limit.
  • The updated reporting standards (RFC 9990 and 9991) provide better visibility into SPF failures, making it easier to diagnose and fix flattening-related issues.

Learn more: DMARCbis Explained – What’s Changing and How to Prepare

Why SPF Flattening Matters for Your Email Strategy

SPF flattening is an essential practice for organizations relying on email for communication. By addressing SPF lookup limits, you can ensure uninterrupted email delivery, strengthen your defenses against spoofing, and optimize your email strategy.

As email authentication enforcement intensifies, with Google, Yahoo, Microsoft, and Apple all mandating SPF, DKIM, and DMARC for bulk senders, and the DMARCbis standards now officially published, proper SPF management is no longer optional. It’s the baseline for email deliverability in 2026 and beyond.

Take Action Today: Begin implementing SPF flattening to secure your domain and improve email deliverability. Need help? Contact us to explore automated SPF flattening tools to simplify the process.

FAQs

Does SPF Flattening Have Limitations?

SPF Flattening does come with a set of limitations making macros a more effective alternative. Let’s explore what these are below:

Flattening Requires Manual Updates: SPF flattening requires constant manual updates whenever your email vendors change or add to their IPs.

Flattening Can Lead to Length Limitations: Flattened SPF records can get very long and easily exceed the SPF record length limit, leading to errors.

Potential SPF Failures: As traditional flattening doesn’t lead to dynamic IP updates, it can lead to SPF failures.

Complexity in Management: Since SPF flattening needs regular manual interventions and updates, it can introduce a lot of complexity for organizations using multiple third-party email vendors.

How Does SPF Flattening Adapt to New Email Senders?

Dynamic SPF flattening services or automated flattening tools like PowerSPF can adapt to new email senders. However, the same cannot be said for traditional methods of flattening. In traditional flattening, email senders do not get auto-updated in the sender’s SPF record which may lead to unwanted authentication failures.

How SPF Flattening Ensures Compliance with Verified Email Senders

SPF flattening helps maintain compliance by including only authorized IPs and verified email senders. This reduces the risk of unauthorized email relay. Flattening services optimize SPF records to avoid exceeding the 10 DNS lookup limit, ensuring compliance with RFC limitations. This is especially true for organizations using automated or manual checks, ensuring their SPF records are always up-to-date.

How does SPF Flattening handle duplicate senders and overlapping IP ranges?

To efficiently manage duplicate and overlapping IPs, SPF flattening removes redundant entries and consolidates duplicate IPs, thereby simplifying a domain’s SPF records. It can merge overlapping IP ranges and ensure that all listed IPs belong to verified senders with no conflicting entries.

How to use SPF flattening?

SPF flattening can be implemented manually by replacing include mechanisms with direct IP addresses, or automatically using tools like PowerDMARC’s PowerSPF. The automated approach is recommended for reliability and continuous updates.

Should I use SPF flattening for all domains?

No, SPF flattening is only necessary when your SPF record exceeds the 10 DNS lookup limit or becomes too complex to manage. Simple email setups with few third-party services typically don’t require flattening.

How often should I update a flattened SPF record?

Manually flattened records should be reviewed monthly or whenever email services change. Automated solutions like PowerSPF update continuously. Neglecting updates can lead to mail delivery failures and authentication errors.

What are the alternatives to SPF flattening?

Main alternatives include SPF macros (dynamic resolution), subdomain delegation (distributing email across subdomains), and sender consolidation (reducing the number of email service providers).

Does DMARCbis change how SPF flattening works?

No, DMARCbis (RFC 9989, published May 2026) does not alter the SPF lookup limit, which is governed by RFC 7208. However, DMARCbis tightens DMARC alignment requirements and improves reporting standards, making it even more important to keep SPF records error-free so they pass alignment checks reliably.

SPF flattening