TXT record: what it is and how to check it

Holds free text, used for SPF, DKIM, DMARC, MTA-STS and domain ownership checks.

Check with the TXT Lookup

What it is

A TXT record holds arbitrary text attached to a name. It was defined in RFC 1035 for human-readable notes, but today it is mostly used for machine-readable policies that other systems look up. The most important ones are:

Use Where it lives Starts with Specification
SPF: which servers may send mail for the domain the domain itself v=spf1 RFC 7208
DKIM: public key for checking email signatures <selector>._domainkey.example.com v=DKIM1 RFC 6376
DMARC: what to do with mail that fails SPF and DKIM _dmarc.example.com v=DMARC1 RFC 7489
MTA-STS: announces a TLS policy for incoming mail _mta-sts.example.com v=STSv1 RFC 8461
TLS-RPT: where to send TLS failure reports _smtp._tls.example.com v=TLSRPTv1 RFC 8460
BIMI: brand logo for supporting mailboxes default._bimi.example.com v=BIMI1 industry draft
Domain verification usually the apex provider-specific none

How it works

A TXT lookup works like any other: a resolver asks for type TXT on a name and gets back every TXT record there. The program that asked then picks the record it needs, typically by its prefix. A receiving mail server checking SPF, for example, fetches all TXT records of the sender’s domain and keeps the one beginning with v=spf1.

Inside the DNS protocol, a TXT record is a sequence of one or more character strings, each at most 255 bytes long. Most applications, including SPF, DKIM and DMARC, join the strings together with no separator. This is how long values fit in a single record.

Syntax and fields

Field Example Meaning
Name example.com. The name the text belongs to.
TTL 3600 Cache lifetime in seconds.
Class IN Internet.
Type TXT The record type.
Data "v=spf1 mx -all" One or more quoted strings, each up to 255 bytes.

In zone files, wrap each string in double quotes. A literal quote inside the text is written \". Most DNS provider panels add the quotes for you; if you type them yourself as well, the record may end up with quote characters inside the value.

Examples

SPF allowing the domain’s MX servers and one provider, and rejecting everything else:

example.com.   3600  IN  TXT  "v=spf1 mx include:_spf.example.net -all"

DMARC with a quarantine policy and aggregate reports:

_dmarc.example.com.   3600  IN  TXT  "v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com"

A DKIM public key split into two strings, because it is longer than 255 characters (key shortened here):

s1._domainkey.example.com.  3600  IN  TXT  ( "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA"
                                              "u5Wd8kQ0rCb3...IDAQAB" )

MTA-STS and TLS-RPT:

_mta-sts.example.com.    3600  IN  TXT  "v=STSv1; id=20261026T000000"
_smtp._tls.example.com.  3600  IN  TXT  "v=TLSRPTv1; rua=mailto:tlsrpt@example.com"

A site verification token next to SPF on the apex:

example.com.   3600  IN  TXT  "example-site-verification=4f9a2c1e7b"

Common mistakes

  • Two SPF records. Publishing v=spf1 ... twice on the same name makes SPF evaluation return permerror, which many receivers treat as a failure. Merge them into one record.
  • More than 10 DNS lookups in SPF. Each include, a, mx, ptr, exists and redirect costs a lookup, including those inside included records. RFC 7208 caps the total at 10, and also allows at most 2 “void” lookups that return no data. Beyond that, SPF fails with permerror. The SPF checker counts them for you.
  • A single string longer than 255 bytes. Some panels split long values automatically; others reject them or truncate them. If a DKIM key fails to validate, check that it was split into strings rather than cut.
  • Extra quotes or spaces. A record that reads "\"v=spf1 -all\"" or starts with a space will not be recognised.
  • Wrong name. DMARC belongs at _dmarc.example.com, not at example.com. DKIM belongs at selector._domainkey.example.com. Many panels automatically append the domain, so typing _dmarc.example.com may create _dmarc.example.com.example.com.
  • TXT on a CNAME name. A name with a CNAME cannot hold a TXT record. Some DKIM setups deliberately use a CNAME to the provider’s key instead, which is fine as long as you do not also add a TXT there.

How to check it

Use the TXT lookup to see every TXT record on a name, with each string shown as published. For email policies, the dedicated tools parse and validate the content: the SPF checker evaluates includes and counts lookups, the DMARC checker explains each tag, and the DKIM checker reads the key for a given selector. The email checker runs all of them at once.

  • MX: where incoming mail goes; SPF’s mx mechanism refers to it.
  • CAA: another policy record, for certificate issuance.
  • CNAME: sometimes used instead of a TXT for delegated DKIM keys.

Frequently asked questions

How long can a TXT record be?

Each string inside a TXT record is limited to 255 bytes, but one record can hold several strings, which are joined together when read. Long values such as 2048-bit DKIM keys are therefore split into multiple quoted strings. Very large responses may need TCP or EDNS, so keep TXT records reasonably short.

Can I have more than one TXT record on a name?

Yes, and it is common: SPF and several verification codes often share the apex. The exception is SPF itself: a domain must have only one TXT record that starts with v=spf1. The same applies to DMARC at _dmarc.

Can I delete old verification TXT records?

Usually yes, once the service has confirmed ownership, but some services re-check periodically and will mark the domain as unverified if the record disappears. Check the service's documentation before removing it.

Should I still use the SPF record type?

No. A dedicated SPF record type (type 99) existed, but RFC 7208 deprecated it. SPF policies must be published as TXT records.