Your next big idea starts with a name. Find yours
The blogDNS
THE NAMESILO BLOG

Safe Record Deletion: Retiring Old DNS Entries Without Outages

Safe Record Deletion

DNS zones accumulate records over time. You add a subdomain for a project, create records for a service you're testing, configure email through a provider you later switch away from. Months or years pass, and your DNS zone contains dozens of records, some critical, some obsolete, and many whose purpose you've forgotten entirely.

Cleaning up unused DNS records seems straightforward: identify what's not needed and delete it. The risk comes from making incorrect assumptions about what's actually unused. That forgotten TXT record might be essential for a critical service. The subdomain you thought was abandoned might still receive traffic. The old MX record could be the reason some customers' email still reaches you.

Safe DNS cleanup requires methodology, not guesswork. The process involves understanding what you have, determining what's actually in use, making changes conservatively, and monitoring for problems before considering the cleanup complete.

Why DNS Cleanup Matters

Beyond organizational tidiness, maintaining a clean DNS zone has practical benefits.

Security exposure: Old DNS records can create security vulnerabilities. A subdomain pointing to a decommissioned server that someone else now controls could serve malicious content under your domain. An obsolete CNAME pointing to an expired service might be exploited. TXT records for services you no longer use could be leveraged in attacks if those services are compromised.

Management complexity: A cluttered DNS zone makes it harder to understand your current infrastructure. When you need to make changes quickly during an incident, extra records create confusion about what's actually important.

Cost implications: Some DNS providers charge based on the number of records or queries. Unused records serving no purpose contribute to costs without providing value.

Cognitive load: Every time you review your DNS configuration, you spend mental energy parsing through obsolete records to find what matters. This slows down routine maintenance and increases the chance of making mistakes.

Creating a Complete Inventory

Before deleting anything, document everything you currently have. This inventory becomes your reference point for decisions and your rollback plan if something goes wrong.

Categorize each record: Go through your zone record by record and note:

  • Record type (A, CNAME, MX, TXT, etc.)
  • Hostname or subdomain
  • Value or target
  • Current TTL
  • When it was created (if your DNS provider tracks this)
  • Known purpose (if you remember or can determine it)

Example inventory format:

Record Type | Hostname | Value | TTL | Purpose | Status

A | @ | 192.0.2.1 | 3600 | Main website | Active

A | www | 192.0.2.1 | 3600 | Website www subdomain | Active

CNAME | blog | blogging-service.example.com | 3600 | Company blog (defunct) | Unknown

MX | @ | mail.oldprovider.com | 3600 | Previous email provider | Unknown

TXT | @ | google-site-verification=abc123 | 3600 | Google verification | Unknown

This inventory reveals patterns: multiple records pointing to the same destination, records for services you recognize as discontinued, verification TXT records from years ago.

Identifying Candidates for Deletion

With a complete inventory, evaluate each record's current necessity.

Obvious candidates:

  • Records for services you know you've discontinued
  • Verification TXT records for domains you've already verified (and the service doesn't require ongoing presence)
  • Records pointing to infrastructure that no longer exists
  • Duplicate records serving the same purpose
  • Test or development subdomains no longer in use

Records requiring investigation:

  • Anything whose purpose you don't clearly remember
  • Records pointing to external services you might still use indirectly
  • Email-related records (MX, SPF, DKIM, DMARC) when you've changed providers
  • Subdomains you don't recognize
  • TXT records with obscure content

Never delete without verification:

  • Production website A records
  • Active email MX records and authentication (SPF, DKIM, DMARC)
  • Records for services users actively access
  • Nameserver (NS) records for your domain
  • SOA records (these are zone metadata, not typical records you'd manually manage)

Checking for Active Usage

Don't rely on memory or assumptions. Verify whether records are actually in use.

Query DNS to see current values:

dig A subdomain.example.com

dig CNAME blog.example.com

Confirm the records exist and resolve as expected. If a record doesn't resolve or returns unexpected results, your inventory might be out of date.

Check web server logs: If you control the servers your records point to, examine access logs for the hostnames in question. A subdomain receiving zero requests over weeks or months is likely safe to remove. One receiving occasional requests needs investigation before deletion.

Monitor traffic for subdomains: Set up basic monitoring for questionable subdomains before deleting them. Even a simple curl request once per hour for a few days reveals whether the endpoint is accessible and whether anyone might be using it.

Review email server logs: Before removing old MX records or email authentication records, verify your current email configuration handles all incoming mail. Check whether the old server still receives any messages.

Search your codebase and documentation: If you have application code, search for references to subdomains or specific DNS records. Configuration files, environment variables, and documentation might reference DNS records you've forgotten about.

Check third-party integrations: Review services connected to your domain. A forgotten integration might depend on a specific CNAME or TXT record. Email providers, CDNs, monitoring services, analytics platforms, all potentially have DNS requirements you configured and forgot.

Test the endpoint: Try accessing the hostname in a browser or via curl. If it doesn't respond or returns errors, the record might be unused, or the service might be broken and users are already experiencing problems you haven't noticed.

The Staged Deletion Process

Never delete multiple records simultaneously or assume a single check confirms a record is unused. Safe deletion involves deliberate stages with monitoring between each step.

Stage 1: Lower the TTL

Before making any changes, reduce the TTL for records you're considering deleting to 3600 seconds (1 hour). This doesn't affect current functionality but ensures that if you need to roll back later, the rollback propagates quickly.

Wait 24-48 hours after lowering TTL before proceeding. This ensures all DNS servers worldwide have cached the short TTL value.

Stage 2: Create a record of what you're changing

Document exactly what you're about to delete:

  • Complete record details (type, hostname, value, TTL)
  • Reason for deletion
  • Date of deletion
  • Who performed the deletion

This documentation enables quick restoration if needed.

Stage 3: Delete one record (or one category) at a time

Don't delete everything at once. Start with the safest candidates:

  • Obviously obsolete verification TXT records
  • Test subdomains you're certain are unused
  • Duplicate records where multiple entries exist for the same purpose

Delete the record and immediately move to monitoring.

Stage 4: Monitor for 24-48 hours

After each deletion, watch for:

  • User reports of broken functionality
  • Monitoring alerts
  • Error rate increases
  • Traffic pattern changes
  • Email delivery problems

The monitoring period should extend beyond the previous TTL. Even with lowered TTL, some systems might cache records longer than specified.

Stage 5: Document success or rollback

If monitoring reveals no issues, mark the deletion as successful in your inventory and proceed to the next record.

If problems appear, immediately restore the record to its previous state. With lowered TTL, restoration takes effect within minutes.

Special Considerations for Different Record Types

Different record types carry different risks and require adjusted approaches.

A and AAAA records:

These point domain names to IP addresses. Deleting an A record makes that hostname unresolvable, breaking any service depending on it.

Before deleting:

  • Verify no web services run at that hostname
  • Confirm no applications reference the hostname
  • Check that no CNAMEs point to this hostname
  • Ensure no documentation or user-facing materials reference it

CNAME records:

CNAME records are often easier to evaluate because they point to external services. If you've stopped using a service, the CNAME is likely safe to remove.

However, check whether the target domain is still under your control. A CNAME pointing to another domain you own might be part of internal routing you've forgotten.

MX records:

Email records are high-risk deletion candidates. Removing the wrong MX record means lost email.

Before deleting MX records:

  • Verify your current email provider's MX records are in place and working
  • Confirm the old MX records aren't receiving any mail (check server logs if possible)
  • Ensure SPF records reflect your current email infrastructure
  • Wait at least 72 hours after confirming email works through new records before removing old ones

Consider lowering priority on old MX records before deleting them entirely. Change the priority value to something very high (like 100), effectively making them last-resort fallbacks. If mail continues flowing normally with this change, the records are truly unused.

TXT records:

TXT records often serve critical but non-obvious purposes. They enable email authentication (SPF, DKIM, DMARC), domain verification, service configuration, and security policies.

Before deleting TXT records:

  • Identify what each record does (Google the content if unclear)
  • Verify whether the service still uses the verification
  • Check if email authentication records are current vs. obsolete
  • Test that removing it doesn't break integrations

Some verification TXT records must remain present even after initial verification. Others are only needed during verification and can be safely removed afterward. Read the service's documentation to understand requirements.

SRV records:

SRV records are service-specific. If you've decommissioned the service, the record is safe to delete. However, verify that no clients still attempt to use the service through SRV-based discovery.

NS records:

Nameserver delegation records are critical infrastructure. Deleting NS records for subdomains removes DNS control for that subdomain. Never delete NS records without absolute certainty and a clear plan for migrating DNS management if needed.

Handling Dependencies and Interconnected Records

DNS records often depend on each other. Deleting one record might break others.

CNAME dependencies:

If a CNAME points to an A record in your zone, deleting the A record breaks the CNAME. Before deleting any A record, search your zone for CNAMEs targeting it.

Email authentication chains:

SPF records can include other domains' SPF records. DKIM records correspond to specific selectors configured in mail servers. DMARC records reference domains for report delivery. These form chains where removing one element breaks authentication.

When cleaning up email records, change all related records together, but do so cautiously with monitoring.

TXT records for a single service:

Services like Google Workspace or Microsoft 365 often require multiple TXT records for verification and configuration. Removing one might be fine, but removing all of them could break the service. Review all records related to a service before deleting any.

Rollback Planning and Execution

Despite careful planning, sometimes deletions cause unexpected problems. Fast rollback capability minimizes impact.

Preparation enables fast rollback:

The inventory you created at the start contains all information needed to recreate deleted records. Keep it accessible during cleanup operations.

Lower TTL values before deletion mean restored records propagate quickly. Without this preparation, rollback might take hours to fully propagate.

Recognizing when to rollback:

Monitor actively after each deletion. Watch for:

  • Direct user reports or support tickets
  • Monitoring system alerts
  • Traffic drops to related services
  • Email delivery failures
  • Third-party service integration problems

Don't wait for problems to escalate. If anything unusual appears after a deletion, assume the deletion caused it until proven otherwise.

Executing rollback:

Restoring a record is usually straightforward:

  1. Access your DNS management interface
  1. Recreate the record with exact values from your inventory
  1. Save the change
  1. Verify the record is resolvable via dig or online tools
  1. Continue monitoring for recovery

With short TTL, most systems recover within 5-15 minutes. Without short TTL preparation, full recovery might take hours as old cached "record doesn't exist" responses gradually expire.

Automation and Tooling

For large DNS zones, manual record-by-record evaluation becomes impractical. Tools and automation help manage cleanup safely.

DNS zone comparison tools:

Some tools compare your current DNS zone against a previous export, highlighting what's changed. This reveals records added long ago that you might have forgotten.

Automated traffic analysis:

If you control the infrastructure your records point to, automated log analysis can identify which hostnames receive requests and which are truly dormant.

DNS query logging:

Some DNS providers offer query logging, showing which records are being looked up. Records never queried are strong candidates for deletion. However, absence from logs doesn't guarantee a record is unused, it might be queried infrequently or only from specific locations not captured in logs.

Infrastructure-as-code approaches:

Managing DNS through configuration files (Terraform, Ansible, etc.) provides version control and documentation of changes. This makes it easier to understand the purpose of each record and track when and why it was added.

Maintaining Clean DNS Going Forward

After cleanup, establish practices that prevent accumulation of obsolete records.

Document purpose when creating records:

When adding new DNS records, note why they exist. Many DNS management interfaces have comment or description fields. Use them. A simple note like "verification for Slack integration - March 2024" helps future you understand whether the record is still needed.

Regular review schedule:

Quarterly or semi-annual DNS audits keep zones clean. Review additions since the last audit, verify they're still needed, and remove obsolete entries before they accumulate.

Service decommissioning checklist:

When retiring a service or migrating away from a provider, include DNS cleanup in the decommissioning process. Don't leave records behind "just in case", either keep them intentionally with documentation of why, or remove them.

Use infrastructure-as-code:

Managing DNS through version-controlled configuration files provides automatic documentation and makes it obvious when records are no longer needed because the associated infrastructure no longer exists.

Common Cleanup Mistakes and How to Avoid Them

Deleting records based on guesswork: Never delete a record whose purpose you don't understand without investigating. The hour spent researching is better than the emergency caused by deleting something critical.

Not lowering TTL first: This mistake makes rollback slow if problems occur. Always reduce TTL and wait before making changes.

Deleting multiple records simultaneously: If something breaks, you won't know which deletion caused it. One at a time ensures clear cause and effect.

Assuming quiet means unused: Just because you don't see activity doesn't mean the record isn't important. Scheduled jobs might run monthly, some integrations happen in the background, emergency systems might only trigger during incidents.

Deleting verification records too quickly: Some services require verification TXT records to remain present indefinitely. Others only need them during initial setup. Verify requirements before removing.

Not testing rollback capability: Before starting cleanup, test that you can quickly add and remove a test record. Confirm you have access, permissions, and understanding of your DNS interface. Don't discover access problems during an emergency rollback.

Special Consideration for Domain Transfers

If you're planning to transfer your domain to a new registrar or change DNS hosting providers, DNS cleanup is particularly important.

Pre-transfer cleanup: Remove obviously obsolete records before initiating a transfer. This reduces what needs to be migrated and lowers the chance of configuration errors during the transfer.

Maintain critical records: Ensure all active records are correctly documented. Domain transfers sometimes reset DNS configuration, and you need complete records to restore service.

Post-transfer verification: After completing a transfer, verify all essential records exist and resolve correctly. Some transfers only migrate certain record types, leaving others behind.

When to Seek Help

Some cleanup situations warrant professional assistance or at least additional review.

Large-scale deletions: If you're considering deleting dozens of records, having a second person review the plan reduces risk.

Production systems with high availability requirements: For domains serving critical business functions, the cost of mistakes is high. Professional DNS audit services exist for these situations.

Complex interdependencies: When records form intricate chains of dependencies across multiple services and platforms, expert review helps identify risks you might miss.

Regulatory or compliance considerations: Some industries have specific requirements about maintaining DNS records. Verify compliance implications before deletion.

Making Cleanup Safe and Routine

DNS cleanup doesn't need to be scary if you approach it methodically. The combination of thorough inventory, conservative testing, staged implementation, and active monitoring transforms a risky operation into a routine maintenance task.

The effort invested in preparation, lowering TTL, documenting records, researching purposes, pays off through smooth execution and easy rollback if needed. The hours spent on careful cleanup prevent the days of emergency response that follow hasty deletions.

Start small: clean up obviously obsolete records using the staged process. As you gain confidence and see the benefits of a cleaner DNS zone, expand to more complex cleanup tasks. Over time, maintaining a clean, well-documented DNS configuration becomes natural rather than daunting.

Your DNS zone reflects your infrastructure. Keeping it accurate and uncluttered makes everything else easier, troubleshooting, security audits, migrations, and day-to-day operations. The time spent on safe cleanup is an investment in long-term operational excellence.

WRITTEN BY

NameSilo Staff

The NameSilo staff of writers worked together on this post. It was a combination of efforts from our passionate writers that produce content to educate and provide insights for all our readers.