Home › Developer Tools › SPF Record Generator

SPF Record Generator

Choose the services that send email for your domain, add your own servers' IP addresses and pick a policy. The tool builds a valid v=spf1 TXT record, counts DNS lookups against the limit of 10 and tells you exactly where to publish it.

Last updated:

1. Services that send email for you
2. Your own servers

One per line (or separated by spaces/commas). Use the exact value your provider gives you.

Advanced: exists, redirect, extra hosts
3. Policy for everything else
Import an existing SPF record

Your SPF record


        
DNS lookups in this record0 / 10

    Add it to your DNS

    Type
    TXT
    Host / Name
    @ (example.com)
    Value
    TTL
    3600 (1 hour, or your host's default)

    Replace any existing TXT record starting with v=spf1: a domain may only have one. Then verify it with the SPF Record Checker.

    What each part means

      Advertisement
      Advertisement

      How to use the SPF Record Generator

      1. Enter your domain so the DNS instructions show the right host name.
      2. Tick every service that sends mail as your domain: your mailbox provider, newsletter tool, help desk, store platform and so on.
      3. Add your own servers: IP addresses or CIDR ranges, and tick mx or a if your mail server is the same as those hosts.
      4. Pick a policy. Start with ~all (soft fail) and switch to -all once your DMARC reports look clean.
      5. Copy the TXT record and add it at your DNS host as a single TXT record on the root of your domain (@), replacing any older SPF record.

      SPF syntax reference

      An SPF record is one TXT record that starts with v=spf1, followed by mechanisms that are checked from left to right. The first mechanism that matches the sending IP decides the result. Each mechanism can carry a qualifier: + pass (the default), - fail, ~ soft fail or ? neutral.

      TermMatches when…DNS lookups
      ip4:203.0.113.5 / ip4:203.0.113.0/24The sender's IPv4 address equals the address or is inside the range0
      ip6:2001:db8::/32The sender's IPv6 address is inside the range0
      a / a:host.example.comThe sender's IP is one of the A/AAAA addresses of the domain (or the named host)1
      mx / mx:example.comThe sender's IP is one of the domain's MX servers1 (plus up to 10 address lookups for the MX hosts)
      include:_spf.google.comThe SPF record of the included domain returns pass1, plus every lookup inside that record
      exists:%{i}.bl.example.comAn A record exists for the (usually macro-built) name1
      ptrReverse DNS of the sender ends in the domain. Deprecated by RFC 7208: do not use1 or more
      redirect=example.comModifier: if nothing matched, use another domain's SPF record instead1
      -all / ~all / ?allAlways matches; put it last as the default answer0

      Staying under the 10-lookup limit

      RFC 7208 caps an SPF evaluation at 10 DNS-querying terms, counted across the whole tree of includes, and at 2 "void" lookups that return no answer. A typical small business with Google Workspace, a newsletter tool and a help desk stays well under the limit, but every extra marketing or CRM service adds its own nested lookups. If you get close:

      • Remove includes for services you no longer use. Old providers are the most common cause of permerror.
      • Replace a and mx with explicit ip4:/ip6: ranges when your server addresses rarely change.
      • Send bulk or marketing mail from a subdomain (for example news.example.com) with its own SPF record. The limit applies per domain checked.
      • Avoid "flattening" services that copy a provider's IPs into your record unless they update it automatically: providers change their ranges without notice.

      SPF, DKIM and DMARC together

      SPF authorises servers for the envelope sender (Return-Path); DKIM adds a cryptographic signature tied to a domain; DMARC tells receivers what to do when the visible From domain is not aligned with a passing SPF or DKIM result. After publishing SPF, set up DKIM in each sending service and then publish a DMARC policy with the DMARC Record Generator, starting at p=none to collect reports.

      Frequently asked questions

      What is an SPF record?

      SPF (Sender Policy Framework, RFC 7208) is a TXT record on your domain that lists the servers allowed to send email using your domain in the envelope sender (Return-Path). Receiving servers check the sending IP against it and record pass, fail, softfail or neutral.

      Can a domain have two SPF records?

      No. A domain must publish exactly one TXT record that starts with v=spf1. If there are two, receivers return a permerror and SPF fails for every message. Merge all services into one record instead.

      What is the 10 DNS lookup limit?

      An SPF check may trigger at most 10 DNS lookups. The mechanisms include, a, mx, ptr and exists and the redirect modifier each count as one, and lookups inside included records count too. Going over the limit makes SPF return permerror. ip4, ip6 and all do not count.

      Should I use ~all or -all?

      ~all (soft fail) asks receivers to accept but mark mail from unlisted servers, which is safer while you are still finding all your senders. -all (hard fail) says unlisted servers are not allowed. With DMARC in place, most receivers rely on the DMARC policy, so either works once all senders are listed.

      Is SPF enough to stop spoofing?

      No. SPF only checks the hidden envelope sender, not the From address people see. Add DKIM signing and a DMARC record so that receivers can verify the visible From domain and act on failures.

      How long until a new SPF record works?

      As soon as resolvers pick it up. A new record is usually visible within minutes; if you replaced an old record, allow up to the old record's TTL (often 1 hour) for caches to expire.

      What is the maximum length of an SPF record?

      Each string inside a TXT record can hold at most 255 characters, but one record may contain several strings that are joined without spaces. Keep the full DNS response under 512 bytes where possible; this tool splits long records into quoted strings automatically.

      Are all the tools on FreeToolCabin tested for quality and accuracy?

      Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

      Related tools

      SPF Record CheckerLook up a domain's SPF record, count nested DNS lookups, find errors and test a sender IP.DMARC Record GeneratorCreate a DMARC TXT record with policy, reporting and alignment options, every tag explained.Email Header AnalyzerPaste raw email headers to trace every server hop, see delays and check SPF, DKIM and DMARC.DNS LookupLook up A, AAAA, MX, TXT, NS, CNAME, SOA and CAA records with TTLs over secure DNS.Email ValidatorCheck email lists and spot disposable addresses.Website Down CheckerCheck if a website is down for everyone.Deep Link GeneratorCreate links that open directly in apps.URL ParserBreak a URL into its parts and edit query string parameters with a live rebuild.User Agent ParserSee your user agent and parse any UA string into browser, OS, engine and device.HTTP Status CodesSearch every HTTP status code with plain-English meanings, causes, fixes and RFC references.Subnet CalculatorCalculate IPv4 network, broadcast, host range, masks and host count, and split subnets.Bulk URL OpenerOpen a list of URLs in new tabs at once or in batches, with cleanup, dedupe and delay.API Request TesterSend GET, POST, PUT and DELETE requests with headers and a body, then inspect the response.WebSocket TesterConnect to a ws:// or wss:// server, send messages and watch a timestamped live log.WHOIS LookupLook up who registered a domain or IP: registrar, creation and expiry dates, name servers, status.Mailto Link GeneratorBuild encoded mailto: links with cc, bcc, subject and body, plus HTML code and a QR code.WhatsApp Link GeneratorCreate wa.me click-to-chat links with a pre-filled message, button HTML and a QR code.Basic Auth Header GeneratorCreate an Authorization: Basic header from a username and password, or decode one.Common Ports ListSearchable TCP/UDP port number list with service, protocol and description, filterable by range.DMARC CheckerLook up a domain's DMARC record, explain every tag, grade the policy and get fix suggestions.IP Geolocation LookupFind the country, city, ISP, ASN and time zone of any IP address or domain, with a map.Reverse DNS LookupFind the PTR hostname of any IPv4 or IPv6 address, one at a time or hundreds in bulk.CIDR to IP RangeConvert IPv4 or IPv6 CIDR blocks to first/last IP, mask and host count, and export IP lists.DNS Propagation CheckerCompare DNS answers and TTLs from Cloudflare, Google, Quad9, AdGuard and NextDNS side by side.Domain Availability CheckerCheck if domain names are available across .com, .io, .ai and more, with registrar and expiry.MAC Address LookupFind the vendor of a MAC address or OUI, check multicast and random bits, look up many at once.MX LookupFind a domain's mail servers: MX priority, host, IP addresses and the email provider.Uptime SLA CalculatorTurn 99.9% uptime into allowed downtime per day, month and year, or downtime into uptime %.Website Speed TestTest page speed with Lighthouse: performance score, Core Web Vitals and fixes, mobile or desktop.ASN LookupLook up an AS number or IP: network owner, country, registry, abuse contact and announced prefixes.Bandwidth CalculatorEstimate monthly website bandwidth (GB) and the Mbps you need from page views and page size.CNAME LookupFollow a hostname's full CNAME chain to its final IP addresses, with TTLs and CDN detection.CORS TesterSend GET, POST or OPTIONS from your browser to any API and see whether CORS allows it and why not.DKIM Record CheckerLook up a domain's DKIM key by selector (or auto-detect), check key type, bit length and tags.DKIM Record GeneratorCreate a DKIM RSA key pair in your browser with the TXT record, selector host and private key PEM.DMARC Report AnalyzerRead DMARC aggregate XML reports (.xml, .gz, .zip): sources, SPF/DKIM alignment and pass rates.Domain Age CheckerSee how old a domain is, when it was registered and when it expires. Bulk check up to 50.Email Deliverability CheckerGrade a domain's MX, SPF, DMARC, DKIM, BIMI and MTA-STS records in one report with fixes.IPv6 Subnet CalculatorIPv6 prefix to network, range, address count and /64s, and split it into child subnets.Link in Bio Page GeneratorCreate a link-in-bio page with avatar, bio, links and theme, then download it as one HTML file.NS LookupFind a domain's authoritative nameservers with their IPs, SOA record and DNS hosting provider.Social Share Link GeneratorMake share links and buttons for Facebook, X, LinkedIn, Reddit, Pinterest, WhatsApp and email.Subnet Mask Cheat SheetInteractive /0 to /32 table of subnet masks, wildcards and host counts with details per prefix.TXT Record LookupLook up a domain’s DNS TXT records and see which are SPF, DMARC, DKIM or verification tokens.VLSM CalculatorSplit a network into variable-length subnets sized to the hosts each one needs.YouTube Timestamp Link GeneratorMake YouTube links that start at a set time, embed start/end codes and lists of timestamps.Email ObfuscatorHide an email address from spam bots with HTML entities, a JavaScript mailto link or reversed CSS text.Email PermutatorGenerate every common business email format from a first name, last name and company domain.HTTP Header ParserPaste raw HTTP headers to get a table explaining each one plus a security headers grade.IP Blacklist CheckerCheck an IPv4 address against 21 public spam blocklists (DNSBLs) and see listed or clean.IP Range to CIDRTurn a start and end IP into the shortest list of CIDR blocks, for IPv4 and IPv6.
      See all 52 Network, DNS & Email Tools →