What is a TXT record?

A TXT record attaches free-form text to a DNS name. Today it is mostly used for machine-readable data such as SPF, DKIM and DMARC policies and domain ownership verification tokens.

The TXT type was designed for human-readable notes, but because any text fits in it, it became the standard place for small pieces of configuration that other systems read. Email authentication is the best-known case: SPF lives in a TXT record at the domain itself, DKIM keys at selector._domainkey, and the DMARC policy at _dmarc.

Services that need proof that you control a domain often ask you to publish a TXT record containing a random token. They then query the DNS, and the presence of the token shows that whoever requested the verification can edit the zone.

A single string inside a TXT record is limited to 255 characters, so long values such as DKIM keys are split into several quoted strings that the reader joins back together. A name may have many TXT records, but it must have only one that begins with v=spf1; two SPF records make SPF evaluation fail.

Example

example.com.  3600  IN  TXT  "v=spf1 ip4:192.0.2.0/24 -all"
example.com.  3600  IN  TXT  "site-verification=abc123"

Check it

See how TXT record looks for a real domain:

DNS lookup