What is TXT record

A TXT (Text) record is a type of DNS (Domain Name System) record that allows the domain owner to store text-based information in the DNS. This information can be used for a variety of purposes, including verifying domain ownership, improving email security, and providing general information about the domain.
Table of Contents
Domain Verification
Many services, such as Google and Microsoft, use TXT records to verify domain ownership. They provide a unique string that you add to your domain’s DNS records.
Example:

Email Security
- SPF (Sender Policy Framework): Used to specify which mail servers are permitted to send email on behalf of your domain.
Example:

DKIM (DomainKeys Identified Mail): Used to add a digital signature to your email, ensuring that the email content has not been altered.
Example:

DMARC (Domain-based Message Authentication, Reporting & Conformance): Used to define how your domain handles suspicious emails and to provide a way to report back to you.
Example:_dmarc.example.com. 3600 IN TXT "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com"
General Information
You can use TXT records to store arbitrary text information, such as notes about the domain or instructions for administrators.
Example:

Other Uses
- Verifying third-party services: Some third-party services (like cloud providers, content delivery networks, etc.) may require a TXT record to verify that you own the domain before allowing certain integrations.
- DNS-based Authentication of Named Entities (DANE): Using TLSA records in conjunction with DNSSEC to provide secure connections.
TXT records are versatile and provide a way to include human-readable information within your DNS setup, making them a valuable tool for a wide range of applications.
Why we need to update the DNS record
Updating DNS records is often necessary to ensure that your domain and associated services are functioning correctly and efficiently. Here are some common reasons for updating DNS records:
- Changing Hosting Providers: When you switch to a new hosting provider, you need to update the DNS records to point to the new server’s IP address to ensure your website remains accessible.
- Email Server Changes: If you move your email services to a different provider or change the configuration of your email server, you need to update DNS records like MX (Mail Exchange) and TXT records for SPF, DKIM, and DMARC.
- Subdomain Management: Adding or modifying subdomains requires updating DNS records to point the subdomain to the appropriate server.
- SSL/TLS Certificates: When setting up SSL/TLS certificates, especially for domain validation, you might need to add TXT records for verification purposes.
- Load Balancing and Failover: If you are setting up load balancing or failover mechanisms, you may need to update DNS records to distribute traffic across multiple servers or reroute it in case of server failure.
- Service Integrations: Integrating with external services (like Google Workspace, Microsoft 365, etc.) often requires adding or updating DNS records for verification and configuration purposes.
- IP Address Changes: If your server’s IP address changes (due to migration, reconfiguration, etc.), you’ll need to update A or AAAA records to reflect the new address.
- DNS Record TTL Adjustment: Adjusting the TTL values can help manage how quickly changes propagate across the internet. Lowering TTL before making significant changes ensures that updates take effect more quickly.
- Security Enhancements: Adding or updating DNS records for security purposes, such as implementing DNSSEC (DNS Security Extensions) or configuring proper SPF, DKIM, and DMARC records to prevent email spoofing.
- Removing Deprecated Records: Over time, certain services or configurations may become obsolete, and their corresponding DNS records should be removed to keep the DNS zone clean and efficient.