DNS record types · Updated

DNS TXT record

A TXT record stores a piece of text in DNS. It started as a free-form note and is now used mostly for machine-readable settings: SPF, DKIM and DMARC for email, and verification tokens that prove you control a domain.

Look up a TXT record

Check what DNS returns right now:

Format and example

example.com.   3600   IN   TXT   "v=spf1 include:_spf.example.net -all"
  • Name: The name the text belongs to. DMARC uses _dmarc.example.com and DKIM uses selector._domainkey.example.com.
  • TTL: Seconds a resolver may cache the text.
  • Value: One or more quoted strings of up to 255 characters each. Longer values, such as DKIM keys, are split into several strings that readers join together.

Common mistakes

  • Publishing two SPF records. A domain may have only one TXT record starting with v=spf1; two make SPF fail. Merge them.
  • Putting a record at the wrong name. A DMARC record at example.com instead of _dmarc.example.com is ignored.
  • Pasting smart quotes or stray line breaks from a document. The record must contain plain text.
  • Breaking a long value in the wrong place. Your DNS host usually splits strings for you; if you split by hand, no characters may be lost between the parts.

Related record types

MX record, CNAME record. The DNS record types guide compares them all.

Frequently asked questions

What is a TXT record used for?

Mostly for email authentication (SPF, DKIM, DMARC) and for proving you own a domain to services such as search consoles and email providers. Each use sits at a specific name.

How long can a TXT record be?

Each quoted string holds up to 255 characters, and a record can hold several strings that are joined. The whole answer must still fit in a DNS response, so keep the number of TXT records on one name modest.

Can I have more than one TXT record on the same name?

Yes. Verification tokens and other records commonly sit side by side. The exception is SPF: only one record may start with v=spf1.

How do I view the TXT records of a domain?

Use the lookup above, or run dig example.com TXT +short, or nslookup -type=TXT example.com.

Why does my TXT record not show up?

It may not have propagated yet, or you added it at a different name than the one being checked. Check the exact name with the lookup, and see how long DNS changes take to spread.