1. Home
  2. Developer
  3. DMARC & SPF Generator

DMARC & SPF Generator

Build SPF and DMARC records and validate the syntax of ones you already use.

For every format and option in one place, use Server Config Generators →

Runs in your browser · No upload
Common sending services (include)
Lookups made inside each include cannot be counted here. Each service uses a few more, so the real number may be higher.
SPF record value (TXT)
v=spf1 mx ip4:203.0.113.0/24 include:_spf.google.com ~all
DNS lookups
2 / 10 (not counting lookups inside includes)
Length
57

Use @ (or the domain itself) as the host/name and TXT as the type.

How to use

  1. In Build SPF, tick the services that send mail for you (Google Workspace, Microsoft 365 and so on), add the IPs of servers you run yourself under ip4 and ip6, and pick the final all value. The SPF record value is built for you.
  2. In Build DMARC, set the domain, the policy (p) and the address that should receive reports (rua). The host name for the TXT record (_dmarc.yourdomain) is shown under the result.
  3. Copy the value and add it as a TXT record in your DNS panel. SPF goes on the domain itself (host @), DMARC on the _dmarc host.
  4. Paste a record you already use into Check a record to get a term-by-term list of problems.

Reading an SPF record

SPF publishes in DNS the list of servers allowed to send mail for your domain. The default settings give:

v=spf1 mx ip4:203.0.113.0/24 include:_spf.google.com ~all

Term Meaning
v=spf1 SPF version (must come first)
mx mail from this domain’s MX servers is allowed
ip4:203.0.113.0/24 mail from this IPv4 range is allowed
include:_spf.google.com pull in that domain’s SPF rules
~all any other server is a softfail (suspicious)

Choose all carefully. -all fails, ~all softfails, ?all is neutral. +all authorizes every server and makes SPF pointless, so the tool flags it as an error. A common path is to start with ~all, watch the reports, then move to -all.

The 10 DNS lookup limit is the classic trap. include, a, mx, ptr, exists and redirect each count as one lookup, and above 10 receivers return permerror. This tool counts only the terms you entered. Lookups made inside each include cannot be known offline, so with several services the real number is higher. IP ranges (ip4, ip6) cost no lookups, so listing a range yourself leaves more headroom than adding another include. The include values in the preset list are a convenience; the provider’s documentation is the authority.

One TXT string holds at most 255 characters, so a long record must be split into several strings. Above 255 the tool shows a separate value for DNS entry. Around 450 characters in total it warns because the DNS answer may exceed the UDP size.

Rolling out DMARC

DMARC checks whether SPF and DKIM results align with the From address and tells receivers what to do with mail that fails.

Stage Example record Effect
1. Observe v=DMARC1; p=none; rua=mailto:dmarc@example.com no change in handling, aggregate reports only
2. Partial quarantine v=DMARC1; p=quarantine; pct=25; rua=mailto:dmarc@example.com 25% of failing mail goes to spam
3. Reject v=DMARC1; p=reject; rua=mailto:dmarc@example.com failing mail is refused

Tags equal to their defaults (pct=100, adkim=r, aspf=r, fo=0, ri=86400) are left out. If the report address is on another domain, that domain’s DNS needs an authorization record, and the tool says so. ruf failure reports may carry parts of messages, which raises privacy issues, and few receivers send them.

Frequently asked questions

May I publish two SPF records?

No. More than one TXT record starting with v=spf1 on a domain makes SPF fail. When you add a service, add an include to the existing record and keep a single one.

Will turning on DMARC block mail right away?

With p=none nothing is blocked; you only receive reports. Raise the policy after the reports show every legitimate sender passing.

I published the record but nothing changed.

DNS propagation takes up to the TTL. Also check that the host name does not repeat the domain, as in _dmarc.example.com.example.com.

Can I create a DKIM record here?

No. A DKIM key is a value issued by your mail service that you add as TXT, so it is not part of this tool.

For network ranges use the IP Subnet Calculator and the CIDR Calculator; for site-side files see the robots.txt Generator. This tool checks record syntax only and does not query live DNS. What you enter is processed in your browser and never sent to a server.

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.