Menu

Search tools and guides

DMARC & DKIMCheck DMARC and DKIM, generate records and keys
SPF Record CheckerValidate SPF and count lookups against the limit of 10
DNS Blacklist CheckerCheck IPs and mail servers against spam blocklists
Email Header AnalyserTrace hops, delays and SPF/DKIM/DMARC in raw headers
Email ValidatorSyntax, MX, SPF and DMARC verification
DNS LookupQuery A, AAAA, MX, TXT, NS and more
WHOIS LookupRegistration data over RDAP
Website StatusAvailability and response-time checks
Ports ReferenceWhat runs on each TCP and UDP port, and if it's safe
MAC Address LookupFind a MAC address vendor and check if it's random
Download Time CalculatorHow long a file takes at your broadband speed
QR Code GeneratorQR codes for Wi-Fi, links and text, as PNG or SVG
User Agent ParserWhat your browser says about itself, decoded
IP ConverterDecimal, hex, binary and IPv6 conversion
Subnet CalculatorCIDR ranges, masks and subnet splitting
CIDR AggregatorMerge IPs and ranges into the fewest CIDR blocks
SSL CheckerInspect certificates, chains and expiry
HTTP HeadersAudit security headers and redirect chains
Password GeneratorCryptographically secure random passwords
Hash GeneratorMD5, SHA-1, SHA-256, SHA-384 and SHA-512
JWT DecoderDecode JWT claims and verify HS256, RS256, ES256
Unix Timestamp ConverterConvert epoch seconds or ms to UTC and UK time
UUID GeneratorGenerate UUID v4, v7 and ULIDs; decode any UUID
Cron Expression ExplainerCron schedules in plain English, with next runs
Regex TesterTest JavaScript regex with live match highlighting
Chmod CalculatorUnix permissions as octal, symbols and commands
Colour Contrast CheckerWCAG contrast ratio for text and background colours
JSON FormatterPretty-print, minify and validate JSON
Base64 EncoderConvert to and from Base64, Unicode safe
URL EncoderPercent-encode and decode URL strings
HTML EntitiesEscape and unescape HTML special characters
Text Diff CheckerCompare two texts line by line, word by word
Word & Character CounterWords, characters, reading time and SMS segments
Case ConverterUPPER, lower, Title Case, camelCase and more
URL Slug GeneratorTurn titles into clean, SEO-friendly URL slugs
DNS records explained: A, AAAA, CNAME, MX, TXT, NS and the restWhat each common DNS record type does, the rules that trip people up – CNAMEs at the root, MX pointing at an IP – and how TTL and caching really work.
Mbps and MB/s: why downloads look slower than your broadband speedWhy a 100 Mbps line downloads at 12 MB/s, why a 1 TB drive shows 931 GB, what slows real transfers, and what a UK advertised average speed promises.
Setting up SPF, DKIM and DMARC for Microsoft 365Step by step for a domain on Microsoft 365, from the first SPF record to a DMARC policy of reject, avoiding the mistakes that cause bounces.
SPF "too many DNS lookups": why it happens and how to fix itWhat the ten-lookup limit in RFC 7208 counts, how to tally your own record, and the fixes that work without silently breaking mail.
How to read a DMARC aggregate reportA field-by-field tour of the XML that receivers send to your rua= address, and how to turn it into a list of senders to fix before you enforce.
What your IP address reveals – and what it does notHow IP geolocation really works, why it often puts you in the wrong town, what a website can and cannot learn from your address, and how UK law treats it.
Diagnosing a website that will not load: DNS, TLS and HTTP in orderA methodical checklist for working out whether an outage is DNS, the certificate, the server or just you – and what each kind of failure looks like.

Arrow keys move through results, Enter opens one, Escape closes.

SPF "too many DNS lookups": why it happens and how to fix it

What the ten-lookup limit in RFC 7208 counts, how to tally your own record, and the fixes that work without silently breaking mail.

By BD Digital Creations. Published , updated , 5 minute read.

In short

SPF returns "too many DNS lookups" when evaluating a record takes more than ten DNS lookups, the cap in RFC 7208, and SPF then returns a permanent error, so it cannot pass. Every include, a, mx, exists, ptr and redirect counts, nested ones included. Remove unused includes, drop a and mx if they send nothing, or move senders to subdomains.

On this page

"SPF PermError: too many DNS lookups" is one of the most common email authentication faults, and one of the most damaging, because it fails quietly. Nothing bounces at first. Your SPF record is simply treated as broken by receivers that check it, and once you enforce DMARC, mail that was relying on SPF starts going missing.

It usually creeps up on a domain. Each new service – a helpdesk, a newsletter tool, a payment platform – asks you to add an include: to your SPF record, and one day the record crosses a limit most people never knew existed.

What the limit actually is

#

RFC 7208, the SPF specification, caps the number of DNS lookups a receiver will make while evaluating one SPF record at ten. The cap exists to stop SPF being used to make receivers flood DNS servers with queries. Exceed it and the result is permerror: a permanent error, meaning the record could not be interpreted, so SPF cannot pass.

Not every part of a record counts. These terms trigger a lookup:

TermCounts?Why
include:Yes, 1 – plus everything inside itFetches another domain's SPF record
a, a:Yes, 1Looks up the domain's address records
mx, mx:Yes, 1Looks up MX records (and then their addresses)
exists:Yes, 1Checks whether a constructed name exists
ptrYes, 1Reverse lookup; deprecated – the RFC says not to publish it
redirect=Yes, 1Hands evaluation to another domain's record
ip4:, ip6:NoThe address is in the record itself
allNoMatches everything

The crucial detail is the first row. An include counts as one lookup and every lookup inside the record it points to counts too, all the way down. A single include for a large provider can cost three or four lookups on its own, and providers change their records without telling you, so a record that was within the limit last year may not be today.

There is a second, lesser-known limit, which the RFC recommends rather than requires: no more than two "void" lookups – terms that return no answer at all, typically an include for a service you cancelled whose record has since been deleted. A receiver that applies it also returns a permanent error.

Counting your own record

#

Take a typical small-business record:

v=spf1 a mx include:spf.protection.outlook.com include:servers.mcsv.net
       include:_spf.helpdesk.example include:sendgrid.net ~all

The top level already costs six: a, mx and four includes. Now open each include. Use our DNS Lookup tool to fetch the TXT record for each included domain, and count the lookup terms you find there, then repeat for any includes inside those. Write the tree down:

a                                  1
mx                                 1
include:spf.protection.outlook.com 1  (+ any nested includes)
include:servers.mcsv.net           1  (+ any nested includes)
include:_spf.helpdesk.example      1  (+ any nested includes)
include:sendgrid.net               1  (+ any nested includes)
                                   --
                         at least  6

If the nested totals take you past ten, you have found the problem. Our Email Validator reports the SPF record for a domain, and the DMARC & DKIM Checker shows whether SPF is published and whether more than one SPF record exists – a separate fault that is just as fatal.

The fixes, best first

#

1. Remove what you no longer use

The cheapest lookups to save are the ones doing nothing. Records accumulate includes for trials that ended, agencies that left and platforms you migrated away from. Check each against the list of services you actually send through today. Removing a dead include also removes a likely void lookup.

2. Drop a and mx unless they send mail

Many records start with a mx because a hosting control panel put it there. That authorises your web server and your inbound mail servers to send. If your mail goes through Microsoft 365 or Google Workspace, your MX records point at their receiving servers, which the provider's include already covers, and your website probably sends through an SMTP service rather than directly. If nothing sends from those addresses, delete them: two lookups saved. If your own server does send, replace a with its fixed ip4: address, which costs nothing.

3. Check whether an include does anything for you

This is the fix most people miss. SPF is checked against the envelope sender – the Return-Path or bounce address – not the From: address your recipients see. Most bulk-mail and CRM platforms use their own bounce domain by default, so SPF is evaluated against their domain, and the include in your record is never consulted.

Look at the headers of a message the platform sent for you. If the Return-Path is on the platform's domain rather than yours, the include in your record is dead weight and can go. What makes that platform pass DMARC is DKIM signing with your domain, which you set up in the platform's domain-authentication settings. That is the better route anyway: DKIM survives forwarding and SPF does not.

4. Move senders to subdomains

Each subdomain has its own SPF record with its own budget of ten lookups. Sending marketing mail from news.example.co.uk and transactional mail from mail.example.co.uk splits the load and has a second benefit: a reputation problem on your newsletter cannot drag down delivery of your invoices. With DMARC's relaxed alignment (the default), the authenticated domain only has to share an organisational domain with the From: address, so mail sent through news.example.co.uk can still pass DMARC for a From: address on example.co.uk, because both share the organisational domain example.co.uk.

5. Flattening, with care

"Flattening" replaces includes with the IP ranges they currently resolve to, as ip4: and ip6: terms that cost no lookups. It works, but it freezes a snapshot of someone else's infrastructure into your DNS. When the provider adds a server, your record does not know, and mail from the new server fails SPF without warning. Flatten only with an automated service that re-resolves and republishes the record regularly, and never by hand for a large provider.

What not to do

#
  • Do not split SPF into two records. Publishing a second v=spf1 record to hold the overflow makes SPF a permanent error immediately, for every message.
  • Do not switch to +all. It authorises every server on the internet and is worse than having no record.
  • Do not rely on ~all to hide the problem. A permanent error is not a soft fail; the qualifier on all is never reached.

Why it matters more once DMARC is enforcing

#

Under DMARC, a message passes if either SPF or DKIM passes with alignment. A broken SPF record therefore removes one of your two routes to a pass. Mail that is properly DKIM-signed with your domain carries on regardless; mail that was relying on SPF alone – often a website contact form or an old line-of-business application – starts to fail the moment your policy reaches quarantine or reject. Fixing SPF, and making sure every sender also signs with DKIM, keeps that from happening.

If you are setting up a Microsoft 365 domain from scratch, our step-by-step Microsoft 365 guide covers SPF, DKIM and DMARC together.

Spotted a mistake, or something out of date? Email hello@bddc.co.uk and we will correct it. How we research and maintain these guides is set out in our editorial policy.

Accessibility

Adjust how the site looks and behaves. Your choices are saved in this browser only.

Colour theme
Text size
Accessibility statement