Changing nameservers transfers control of your domain's DNS from one provider to another. Done correctly, visitors experience no downtime during the transition. Done incorrectly, it can take your website and email offline. This guide walks through the complete process safely.
When to Change Nameservers
Common reasons to change nameservers include:
- Moving DNS hosting to Cloudflare for performance and security benefits.
- Switching from your registrar's DNS to a dedicated DNS provider.
- Migrating to a new hosting provider that manages DNS.
- Consolidating multiple domains under one DNS management platform.
- Moving to cloud DNS (AWS Route 53, Google Cloud DNS) for infrastructure-as-code workflows.
Before Changing Nameservers: Preparation
Poor preparation causes downtime. Complete all of these steps before making any changes:
1. Export All Existing DNS Records
Log in to your current DNS provider and export all DNS records as a zone file. Every record must be recreated on the new provider:
# Export zone file using dig (if you know the current nameservers)
dig example.com AXFR @ns1.current-provider.com > zone-backup.txt
# Or use the provider's UI to export a zone file (.txt or .bind format)2. Import Records into the New Provider
Log in to the new DNS provider and create a zone for your domain. Import the exported zone file or manually recreate each record. Double-check:
- A and AAAA records for the website and subdomains.
- MX records for email routing.
- TXT records (SPF, DKIM, DMARC, domain verification).
- CNAME records for subdomains and services.
- Any SRV or CAA records.
3. Lower TTLs on All Records
Lower the TTL on all records at your current provider to 300 seconds (5 minutes). This ensures that after the nameserver switch, old cached responses expire quickly:
# Update all records to TTL 300
example.com. 300 IN A 93.184.216.34
mail.example.com. 300 IN A 93.184.216.35
# ... all other recordsWait at least as long as the old TTL (typically 3600 seconds = 1 hour) before switching nameservers. This ensures all resolvers have refreshed their cache with the shorter TTL.
Step 1: Get the New Provider's Nameservers
After setting up your zone at the new provider, they will give you nameserver addresses. Examples:
| DNS Provider | Nameserver Format |
|---|---|
| Cloudflare | name.ns.cloudflare.com / erin.ns.cloudflare.com |
| AWS Route 53 | ns-XXX.awsdns-XX.com / .net / .org / .co.uk |
| Google Cloud DNS | ns-cloud-X1.googledomains.com (X = a,b,c,d) |
| Namecheap | dns1.registrar-servers.com / dns2.registrar-servers.com |
Step 2: Update Nameservers at Your Registrar
Log in to your domain registrar (where you purchased the domain) and find the nameserver settings. The location varies by registrar:
| Registrar | Where to Find NS Settings |
|---|---|
| GoDaddy | My Products → DNS → Nameservers |
| Namecheap | Domain List → Manage → Nameservers |
| Google Domains | DNS → Custom name servers |
| Cloudflare Registrar | Domain → DNS → Nameservers |
Select "Custom nameservers" and enter all of the new provider's nameservers. Remove the old ones. Save the changes.
Step 3: Verify the Change
Nameserver changes propagate differently than record changes — they go through the TLD nameservers and can take 24–48 hours. Monitor progress:
# Check current NS records
dig example.com NS +short
# Check from a specific resolver to see what they return
dig example.com NS @8.8.8.8
dig example.com NS @1.1.1.1
# Check NS record in the TLD zone (authoritative check)
dig example.com NS +trace | tail -10Use the ShowDNS DNS Propagation Checker to query NS records from multiple global locations simultaneously and track propagation progress.
Step 4: Verify All Records Are Working
Once nameservers have propagated, verify all critical records:
# Check website is resolving
dig example.com A +short
# Check email is configured
dig example.com MX +short
# Check SPF record
dig example.com TXT +short | grep spf
# Test HTTPS is working
curl -I https://example.comAlso test: sending and receiving email, subdomains, any SRV records, and any API endpoints. Use the Check All DNS Records tool for a complete view.
Step 5: Clean Up
After confirming everything is working:
- Raise TTLs back to normal values (3600–86400 seconds) on the new provider.
- Keep the old DNS zone active for at least a week in case you need to roll back.
- Update any internal documentation that references the old nameservers.
Frequently Asked Questions
Will changing nameservers break my email?
Not if you correctly replicate all MX, SPF, DKIM, and DMARC records on the new provider before switching. Email delivery relies on these records being present. The most common mistake is forgetting to copy TXT records (especially DKIM and DMARC).
How long does nameserver propagation take?
Typically 24–48 hours for full global propagation, though many resolvers see the change within minutes to hours. The actual propagation time depends on the TTL of the NS record in the TLD zone — this is set by the registry, not by you.
Can I switch back to the old nameservers if something breaks?
Yes. As long as you have not deleted the old DNS zone, you can switch back immediately at the registrar. The old TTLs (which you lowered before switching) will ensure resolvers pick up the change quickly.