SecDNS

TXT record

TXT records carry arbitrary text data attached to a DNS name and are widely used for email authentication (SPF, DKIM, DMARC), domain verification, and policy publishing.

TXT record

A TXT record holds free-form text data attached to a DNS name, and is the workhorse record type used for SPF, DKIM, DMARC, domain ownership verification, and arbitrary policy.

In plain English

If you need DNS to publish a short string — "Google verifies I own this domain", "these servers are allowed to send my mail", "here is my DKIM signing key" — you put it in a TXT record. It is the generic notice board of DNS.

How it works

TXT is defined in RFC 1035 §3.3.14 with type code 16. The rdata is one or more length-prefixed strings; each string is at most 255 bytes, and consumers typically concatenate them. RFC 7208 (SPF) and RFC 6376 (DKIM) deliberately repurpose TXT instead of inventing new types so they work on any existing DNS host. The DKIM key, the SPF policy v=spf1 ..., the DMARC record v=DMARC1; p=reject; ..., and Let's Encrypt's DNS-01 ACME challenges are all TXT records. Because TXT lacks structure, every consumer must parse the leading tag (v=spf1, v=DKIM1, google-site-verification=...) to decide whether the record is for them. Modern record types like CAA, HTTPS, and SVCB are gradually replacing some TXT usage by giving the data proper structure, but TXT remains dominant.

  • DNS — base protocol
  • SPF — published in TXT
  • DKIM — published in TXT
  • DMARC — published in TXT
  • CAA — a structured replacement for some TXT use
  • TTL — applies to TXT like any record
  • EDNS — required for large TXT responses

SecDNS perspective

The SecDNS zone editor knows the common TXT shapes (SPF, DKIM, DMARC, verification tokens) and lints them for syntax and length so you do not accidentally publish a broken policy.

Frequently asked questions

Is there a length limit?

A single string inside a TXT record is limited to 255 bytes, but the record can contain multiple strings that are concatenated by consumers. The total record size is bound by EDNS limits.

How many TXT records can a name have?

As many as you like. Receivers parse the leading tag (v=spf1, v=DKIM1, google-site-verification=, etc.) to find the one relevant to them.