What Is a DNS TXT Record?
TL;DR
A DNS TXT record is a record type that holds arbitrary text at a name in a DNS zone. Email authentication is built almost entirely on it, because SPF, DKIM public keys, DMARC policies, MTA-STS and TLS-RPT are all published as TXT records at agreed names.
Which email records are TXT records?
Most of them, and they are told apart by the name they sit at rather than by their type. SPF sits on the domain itself, DKIM at selector._domainkey.yourdomain.com, DMARC at _dmarc.yourdomain.com, MTA-STS at _mta-sts.yourdomain.com and TLS-RPT at _smtp._tls.yourdomain.com.
MX and PTR are the exceptions, because each is its own record type. Everything a receiver reads as policy is text inside a TXT record, which is why one mistyped name is enough to make a perfectly written record invisible.
What is the 255 character limit?
A TXT record is made of one or more strings, and a single string may be at most 255 characters, because its length is stored in one byte. A longer value is published as several quoted strings inside the same record.
Resolvers join those strings with nothing between them, so the reassembled value is identical to the original. This is how a 2048-bit DKIM public key fits, split across two strings, and it is why a stray space left at the join is a common reason a key stops verifying.
Can one name hold several TXT records?
Yes, and most zones do at the apex, where domain verification strings from several vendors sit alongside each other. A receiver looking for one specific record reads every TXT record at the name and picks the one carrying the version tag it wants.
SPF is the exception that catches people out. Two records that both begin v=spf1 is a permanent error, so a second sending platform is added inside the existing record rather than published as a new one.
Frequently asked questions
There was, and it is gone. A separate SPF record type existed during the experimental phase and its use has been discontinued, so SPF is published as a TXT record and nothing else. Any tool still asking for an SPF type is out of date.