Guides

What Is a TXT Record? DNS Text Records Explained With Examples

A TXT record is a small piece of text published in DNS. It proves you own a domain, authenticates your email and publishes security policies.

Cysoro Security TeamPublished · 8 min read
GUIDES TXTrecord Text in DNS, explained. example.com — DNS zone TXT "v=spf1 include: _spf.google.com ~all" TXT "v=DMARC1; p=none; rua=mailto:dmarc@" Verified by DNS TTL 3600 · class IN · type TXT
Quick answer

A TXT record is a DNS record that stores text strings for a domain. It does not point visitors to a website or mail server. Instead, other systems read the text to verify domain ownership, check email authentication with SPF, DKIM and DMARC, and enforce security policies such as certificate issuance rules.

Key takeaways

  • A TXT record publishes text in DNS that other systems read, usually for verification or email authentication.
  • SPF, DKIM and DMARC are all published as TXT records, and one wrong character can break email delivery.
  • Each text string is limited to 255 characters, so long values must be split into quoted chunks.

Every domain has a set of DNS records that tell the internet where things live. Most of them point somewhere: an A record points to an IP address, an MX record points to a mail server. A TXT record points nowhere. It just holds text — and that text now runs much of email security.

What is a TXT record?

A TXT record is a DNS record that stores one or more text strings for a domain name. It was defined in RFC 1035 as a place for human-readable notes, but today it mostly carries machine-readable data that other services look up and act on.

Unlike an A or MX record, a TXT record does not direct traffic. Nobody visits your website because of a TXT record, and no email is delivered through one. Instead, a service queries your DNS, reads the text, and decides something: is this sender allowed to email for this domain, does this person own the domain, or may this certificate authority issue a certificate?

One domain can have many TXT records. Each one has a name (the host), a type of TXT, a TTL that controls caching, and a value — the text itself, usually shown in quotation marks. Cloudflare's guide explains that the record was originally meant for notes, but email spam prevention and domain verification are now its most important uses.

How does a TXT record work?

When a service needs to check something about your domain, it sends a DNS query for the TXT type at a specific name. Your authoritative name server answers with the text strings, and the service reads them according to the format it expects.

For example, when a mail server receives email claiming to be from your domain, it can query the TXT record at your root domain to find your SPF policy, and the TXT record at _dmarc.yourdomain.com to find your DMARC policy. If the sending server is not on your SPF list, or the message fails DMARC, the receiver can reject it or send it to spam.

The same lookup pattern powers domain verification. Google, Microsoft and many other providers ask you to add a TXT record containing a unique token, such as google-site-verification=AbCdEf123456. When they query DNS and see the token, they know you control the domain, because only someone with DNS access could have added it.

How a TXT record lookup works Mail serverreceives an emailclaiming to befrom your domain DNS queryasks for the TXTrecord at yourdomain name Decisiontext is read andchecked: accept,quarantine or reject Example answer: "v=spf1 include:_spf.google.com ~all"Only Google's servers may send mail for this domain.
A TXT lookup in action: the receiver asks DNS, reads the policy text, then decides what to do with the message. Illustration by Cysoro.

What are TXT records used for?

TXT records have five common uses: email authentication, domain ownership verification, certificate checks, security policies and service setup. Most domains you manage will have at least one of the first two.

Email authentication: SPF, DKIM and DMARC

This is the biggest use. SPF lists the servers allowed to send mail for your domain, DKIM publishes the public key used to verify signed messages, and DMARC publishes the policy for what receivers should do when a message fails those checks. All three live in TXT records. Our guide to what DMARC is walks through the policy itself.

Domain ownership verification

Google Workspace, Microsoft 365, and certificate authorities ask you to add a TXT record with a unique code. The code proves you control the domain's DNS, which is the standard proof of ownership on the internet. You can usually delete the record after verification, though some services re-check it later.

Security policies

Several policies are published as TXT records. A CAA record is a separate type, but MTA-STS policies and BIMI brand indicators both rely on TXT records. The _mta-sts record tells mail servers where to find your mail transport policy, and BIMI publishes the location of your brand logo for supported mail clients.

Service setup and integrations

Many services use TXT records during setup: site verification for search consoles, email provider configuration, and ACME DNS challenges for certificates, where a _acme-challenge TXT record proves control of the domain before a certificate is issued.

What is the format of a TXT record?

A TXT record in a zone file has five parts: the name, the TTL, the class, the type and the value. In most DNS dashboards you only fill in three fields: host, TTL and value.

A typical SPF record looks like this in a zone file:

example.com. 3600 IN TXT "v=spf1 include:_spf.google.com ~all"

Here example.com. is the name, 3600 is the TTL in seconds (one hour), IN is the internet class, TXT is the type, and the quoted text is the value. The v=spf1 prefix tells any reader that this text is an SPF policy, and ~all means servers not listed should be treated as suspicious.

Values are made of one or more character strings. Each string is limited to 255 characters, and longer values are split into several quoted strings. DigiCert notes that values longer than 255 characters need to be split, with each part enclosed in double quotes.

What are common TXT record examples?

These are the examples you will actually meet. The values below use example.com as a placeholder — never copy them into your own DNS without replacing the domain and the provider-specific parts.

UseHostExample value
SPF@"v=spf1 include:_spf.google.com ~all"
DMARC_dmarc"v=DMARC1; p=none; rua=mailto:[email protected]"
DKIMselector1._domainkey"v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3..."
Google verification@"google-site-verification=AbCdEf123456"
Certificate challenge_acme-challenge"aBcDeFgHiJkLmNoPqRsTuVwXyZ"
MTA-STS_mta-sts"v=STSv1; id=20261125"

The DKIM value is a public key, so in real life it is much longer than the shortened version shown here, and it is split into 255-character chunks. The DMARC value above starts at p=none, which only reports failures — the safe starting policy before you move to quarantine or reject.

Anatomy of a TXT record example.com. 3600 IN TXT "v=spf1 include:_spf.google.com ~all" Nameexample.com. TTL3600 seconds ClassIN (internet) TypeTXT Valuethe text itself Most dashboards ask only for host, TTL and value — the rest is filled in for you.
The five parts of a TXT record, shown with a real SPF example. Illustration by Cysoro.

How is a TXT record different from other DNS records?

TXT records are the only common DNS record type that stores free-form text instead of an address or a pointer. That makes them flexible, but also easy to get wrong, because the meaning of the text depends entirely on the service reading it.

RecordWhat it holdsWhat it does
TXTText stringsVerification, authentication, policies
A / AAAAIP addressPoints a name to a server
MXMail server nameRoutes incoming email
CNAMEAnother nameAliases one name to another
NSName serverDelegates a zone to name servers
CAACertificate policyLimits which authorities may issue certificates

A common mistake is to put an SPF policy in a CNAME or to create two separate SPF records. There must be only one SPF record per domain: multiple SPF TXT records cause SPF to fail, so combine all your sending services into a single record.

How do you add a TXT record?

Adding a TXT record takes a few minutes, but the exact clicks differ by provider. The steps below work in Cloudflare, Google Domains, GoDaddy, Namecheap and most other DNS dashboards.

  1. Open your DNS settings. Log in to your domain registrar or DNS provider and find the DNS or zone editor for your domain.
  2. Add a new record and choose type TXT. Do not pick A, CNAME or MX by mistake.
  3. Enter the host. Use @ for the root domain, or the subdomain the service asks for, such as _dmarc or selector1._domainkey.
  4. Paste the value exactly as given. Copy it from the service, not from a blog post. One missing semicolon or extra space can break an SPF or DMARC record.
  5. Set the TTL. 3600 seconds (one hour) is a sensible default. Use a short TTL such as 300 if you expect to change the record soon.
  6. Save, then verify. Wait a few minutes and check the record with a free DNS lookup tool.

If the provider gives you a value with quotation marks already around it, check whether your dashboard adds its own quotes. Double quotes around a value that already has them can create a broken record in some systems.

How do you check a TXT record?

Checking is as important as adding. Public resolvers may cache an old value, so check from more than one source if a change does not seem to have taken effect.

  • Command line: run dig TXT example.com or nslookup -type=TXT example.com and replace the domain with yours.
  • Online lookup: use a DNS lookup tool and select the TXT type to see what public resolvers return.
  • Email checkers: use an SPF or DMARC checker to test whether the record parses correctly and what policy it actually publishes.
  • Provider tools: Google's admin toolbox and Microsoft's admin center both include record checks that report exactly what they see.

If the record is missing, check that you edited DNS at the right provider. Many domains have their name servers pointed at Cloudflare or another DNS host, so editing records at the registrar has no effect.

What mistakes should you avoid with TXT records?

Most TXT record problems come from small errors, not from misunderstanding the concept. These are the ones support teams see most often.

  • Two SPF records. Merge every sender into one v=spf1 record. Two records make SPF fail outright.
  • More than 10 DNS lookups in SPF. Each include: triggers lookups, and SPF fails after 10. Flatten includes or remove services you no longer use.
  • Copying example values. A DKIM key or verification token belongs to one domain only. Pasting someone else's value proves nothing and breaks authentication.
  • Forgetting the underscore. DMARC lives at _dmarc and DKIM at selector._domainkey. Without the underscore prefix, the record is invisible to the service looking for it.
  • Leaving verification records forever. Old verification tokens are harmless, but a tidy zone is easier to audit. Remove tokens for services you no longer use.
Test before you enforceStart DMARC at p=none and watch the reports for a few weeks. Moving straight to p=reject with a wrong SPF record can block your own legitimate email.

The bottom line

A TXT record is a small text note in DNS that does outsized work: it authenticates your email, proves you own your domain and publishes security policies that other systems enforce for you.

Add each record exactly as your provider gives it, keep only one SPF record, and verify every change with a lookup tool. You can check what your domain currently publishes in seconds with the free DNS lookup tool.

Frequently asked questions

What is a TXT record in simple terms?

A TXT record is a note stored in your domain's DNS settings. It holds text that other services can look up, such as proof that you own the domain or a list of servers allowed to send email for you.

What is a TXT record used for?

The most common uses are email authentication with SPF, DKIM and DMARC, proving domain ownership to Google or Microsoft, and publishing security policies such as CAA records for certificates and MTA-STS for mail transport.

Can a domain have more than one TXT record?

Yes. A domain can have many TXT records, each with a different name and purpose. For example, you can have one TXT record for SPF at the root domain and separate ones for DKIM selectors and DMARC at the same time.

How long does a TXT record take to work?

It depends on the TTL you set and on caching. A new record often shows up within minutes, but resolvers that cached an older answer can take up to the previous TTL to pick up the change. Lower the TTL before a planned change.

What is the 255-character limit on TXT records?

Each individual text string inside a TXT record can hold at most 255 characters. Longer values, such as DKIM public keys, are split into several quoted strings that DNS resolvers join back together when they read the record.

What is the difference between a TXT record and an SPF record?

SPF used to have its own record type, but that type is now obsolete. SPF policies are published as TXT records that begin with v=spf1, and that is the format every mail server looks for today.

How do I check a TXT record?

Use a DNS lookup tool or the dig command with the TXT type, for example dig TXT example.com. You can also use an online DNS checker to see the record as public resolvers see it, which is useful after you make a change.

Can a wrong TXT record break my email?

Yes. A bad SPF record can cause receiving servers to reject your mail, and a wrong DMARC policy can do the same. Always test with a checker after editing, and start DMARC at p=none before moving to stricter policies.

Sources

  1. Cloudflare — What is a DNS TXT record?
  2. DigiCert — What is a TXT record?
  3. Wikipedia — TXT record
  4. PowerDMARC — DNS TXT Record: What It Is, Format and Examples
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against Cloudflare's DNS documentation, DigiCert's TXT record guide and RFC 1035, which defines the TXT record format.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free