Black Friday: 60% off yearly plans with code BF2026, until November 30. See the deal

Learn

TXT record: what it does and how to add one

A TXT record stores text in a domain DNS zone, and it is the standard carrier for domain verification codes and email policies such as SPF. One record holds one or more strings of up to 255 bytes each, and a name can have many TXT records.

The short answer
  • Each string inside a TXT record is limited to 255 bytes; longer values are split into several strings.
  • Multiple TXT records can share one name, so adding a verification code does not replace the others.
  • Most providers want the value pasted exactly, without extra quotes or line breaks.
Try the dns lookupFree, live, no signup

What are TXT records used for?

Common TXT record uses
UseNameExample value
Domain ownership verification@ or a provider-chosen hostgoogle-site-verification=abc123 (code comes from the service)
SPF email sender policy@v=spf1 include:_spf.example.net -all
DKIM public keyselector._domainkeyv=DKIM1; k=rsa; p=MIGf...
DMARC policy_dmarcv=DMARC1; p=none; rua=mailto:dmarc@example.com
Certificate challenge (ACME DNS-01)_acme-challengeA token generated by the certificate authority

The value formats belong to each protocol. DNS itself treats the content as opaque text. See RFC 1035, section 3.3.14.

How are long values split?

Zone file syntax: one record, two strings
example.com.  3600  IN  TXT  "v=spf1 include:_spf.example.net -all"
; strings over 255 bytes are split inside one record
sel._domainkey.example.com. 3600 IN TXT ( "v=DKIM1; k=rsa; p=MIIBIjANBgkq..."
                                         "...rest of the key" )

How do you add a TXT record?

  1. 01

    Copy the exact value

    The service asking for the record shows the name (host) and the value. Copy both without retyping.

  2. 02

    Add the record

    Type TXT, name as given (@ for the bare domain), value pasted as is. Many panels add the surrounding quotes automatically, so do not add your own unless the panel asks.

  3. 03

    Keep existing TXT records

    Each verification and policy is its own record. Delete a record only when its service is no longer used. Exception: a domain must have only one SPF record.

  4. 04

    Check it

    Use the DNS lookup or nslookup -type=TXT example.com 1.1.1.1. Query the exact name, such as _dmarc.example.com, not just the domain.

What goes wrong with TXT records?

Extra quotes or spaces

Some panels add quotes for you. Adding your own can make the stored value start and end with a quote character, and verification fails.

Wrong host name

Verification codes often belong on a specific name such as _dmarc or a provider-chosen host, not on the bare domain.

Two SPF records

A domain should publish a single SPF record. Merge them into one instead of adding a second.

Checking too early

A checker run before the TTL expires may see a cached empty answer. Query the authoritative nameserver first.

How do you keep TXT records tidy?

  • Label each verification record in your own notes with the service that needs it
  • Remove records for services you stopped using, after confirming nothing depends on them
  • Use one SPF record and merge includes into it
  • Keep DKIM and DMARC records on their own names (selector._domainkey and _dmarc)
  • Export the zone before bulk edits so a mistaken delete can be restored

Common questions

What is a TXT record in DNS?

A TXT record is a DNS record type that holds text. It started as a place for human-readable notes and is now used mostly for machine-read data such as SPF policies, DKIM keys and verification tokens.

Can I have multiple TXT records on one domain?

Yes. DNS allows any number of TXT records on one name, and services rely on that. The exception is by convention rather than DNS: a domain should publish a single SPF record, because two cause SPF evaluation to fail.

How long can a TXT record be?

A single string is limited to 255 bytes. Longer values are written as several strings in one record. Providers add their own caps, for example Amazon Route 53 limits a record value to 4,000 characters.

Why is my TXT record not showing up?

Check that you added it at the DNS host the domain nameservers point to, that the name is exact, and that no resolver is serving a cached empty answer. Query the authoritative nameserver directly to bypass caches.

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

SPF is a policy format that is published inside a TXT record. A separate SPF record type once existed but is deprecated, and RFC 7208 says implementations must not use it. Publish SPF as a TXT record starting with v=spf1.

Watch your domains automatically

Aepto monitors expiry, DNS, SSL and uptime for every domain you own and alerts you when something changes. Free for 3 domains.