Ahosting Logo
Knowledge Base

Understanding TXT Records

TXT (Text) records store text information in DNS. They are commonly used for domain verification, email authentication (SPF, DKIM, DMARC), and other purposes.

Common TXT Record Uses

Purpose Example
SPF (email authentication) v=spf1 include:_spf.google.com ~all
DKIM (email signing) v=DKIM1; k=rsa; p=MIGfMA0...
DMARC (email policy) v=DMARC1; p=quarantine; rua=mailto:...
Domain verification google-site-verification=abc123...
SSL verification _acme-challenge.example.com

Adding a TXT Record in cPanel

  1. Go to Zone Editor
  2. Click Manage for your domain
  3. Click + Add Record dropdown
  4. Select Add TXT Record
  5. Enter:
    • Name: Subdomain or @ for root (depends on purpose)
    • Record: The TXT value
    • TTL: Time to live
  6. Click Add Record

SPF Record

SPF specifies which servers can send email for your domain:

v=spf1 +a +mx +ip4:192.168.1.1 include:_spf.google.com ~all
  • v=spf1: SPF version
  • +a: Allow domain A record IP
  • +mx: Allow MX server IPs
  • include: Include another domain SPF
  • ~all: Soft fail all others

DKIM Record

DKIM adds a digital signature to emails. The record name includes a selector:

Name: default._domainkey
Value: v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4...

DKIM is usually set up automatically in cPanel.

DMARC Record

DMARC tells receivers what to do when SPF/DKIM fails:

Name: _dmarc
Value: v=DMARC1; p=quarantine; rua=mailto:[email protected]

Domain Verification Records

Google Search Console

Name: @
Value: google-site-verification=xxxxxxxxxxxxxxxx

Microsoft 365

Name: @
Value: MS=msxxxxxxxx

Facebook Domain Verification

Name: @
Value: facebook-domain-verification=xxxxxxxx

Multiple TXT Records

You can have multiple TXT records for the same name:

@    TXT    "v=spf1 include:_spf.google.com ~all"
@    TXT    "google-site-verification=abc123"
@    TXT    "facebook-domain-verification=xyz789"

TXT Record Length Limits

  • Single string: Maximum 255 characters
  • For longer records: Split into multiple strings
  • cPanel usually handles this automatically

Checking TXT Records

nslookup -type=TXT example.com
dig example.com TXT

Troubleshooting

  • Verification failing: Check exact value matches, wait for propagation
  • SPF failing: Verify syntax, check all sending servers included
  • Record not showing: DNS propagation can take up to 48 hours