TXT Records: SPF, DKIM, DMARC and Verification Tokens
A TXT record holds free text. DNS itself does nothing with it, which is exactly why so much has been built on top: mail authentication, ownership checks for Google and Microsoft, certificate validation. A domain often has a dozen of them.
What a TXT record is
It looks like any other record; the value is one or more quoted strings.
example.com. — The name the text belongs to. Mail policies live at the domain itself or at fixed sub-names such as _dmarc.
Point at, tap or tab to a part of the record to see what it does.
What TXT records are used for
Each use has its own name or its own prefix, which is how receivers find the record that concerns them among all the others.
| Use | Name | Value starts with |
|---|---|---|
| SPF: who may send mail for the domain | @ | v=spf1 |
| DKIM: public key for mail signatures | selector._domainkey | v=DKIM1 |
| DMARC: policy for failed mail | _dmarc | v=DMARC1 |
| MTA-STS: require encrypted delivery | _mta-sts | v=STSv1 |
| TLS-RPT: reports about encrypted delivery | _smtp._tls | v=TLSRPTv1 |
| BIMI: brand logo in the inbox | default._bimi | v=BIMI1 |
| Google ownership verification | @ | google-site-verification=… |
| Microsoft 365 ownership verification | @ | MS=ms… |
| Certificate validation (ACME DNS-01) | _acme-challenge | — |
Several TXT records at one name
Any name may have many TXT records, and receivers simply ignore the ones that are not theirs. It is normal for the domain itself to carry an SPF record next to five verification tokens.
v=spf1 record, and _dmarc must have only one v=DMARC1 record. With two of either, receivers treat the policy as broken — the most common TXT mistake there is.Length limits and quoting
A single string inside a TXT record may hold at most 255 characters. Longer values — DKIM keys, long SPF records — are split into several quoted strings in the same record, and receivers join them back together without spaces:
selector1._domainkey.example.com. 3600 IN TXT (
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu5x"
"Kq1wXbD0rB2…rest of the key…QIDAQAB" )
; receivers join the strings with nothing in betweenMost DNS dashboards do the splitting for you: paste the whole value into one field. Very large TXT sets can exceed what fits in a UDP reply; resolvers then switch to TCP, and a network that blocks DNS over TCP makes the record look missing.
Common mistakes
- Typing the quotes yourself into a dashboard field that adds its own, so the value ends up as
""v=spf1 …"". - Adding the domain to the name: entering
_dmarc.example.comin a field that already appendsexample.comcreates_dmarc.example.com.example.com. - Publishing SPF as a separate record type
SPF. That type was retired in 2014 (RFC 7208); only TXT counts. - Two SPF records after switching or adding a mail provider, instead of one merged record.
- Smart quotes or line breaks pasted from a document into the value.
- Leaving verification tokens forever. They are harmless, but removing them once verified keeps the set readable.
Checking TXT records
Query the domain and the special names separately — dig example.com TXT does not show _dmarc or DKIM records.
dig example.com TXT +short
dig _dmarc.example.com TXT +short
dig selector1._domainkey.example.com TXT +short
dig example.com TXT +tcp # large answers may need TCPFrequently asked questions
Can a domain have more than one TXT record?
Yes, as many as it needs. Only SPF and DMARC are limited to one record each.
What is the maximum length of a TXT record?
Each quoted string is limited to 255 characters, but a record can contain several strings. Practical limits come from the DNS reply size, around a few kilobytes.
Should I put quotes around the value?
In a zone file, yes. In a DNS dashboard, usually no — check whether the provider adds them; a value that ends up wrapped twice breaks SPF and DKIM.
How long until a new TXT record is visible?
A new name is usually visible within minutes. A changed record is visible once the old TTL expires in resolvers' caches.
See the theory in practice — run a TXT Lookup for your own domain.