Contact

We usually reply within 2 hours.

How to move your website to a new host without losing your email

Checked 5 min read

Your website and your email both depend on your domain’s DNS records, but on different ones. Moving the website means changing the records that point at the website and leaving the email records exactly as they are. Email breaks during a move when its records are lost or overwritten, or when the old hosting plan it came with is cancelled.

Find where each part lives

Write these four down before you change anything. They can be four different companies, or one company doing all four.

  • Registrar: the company you renew the domain with. If you’re not sure who that is, How to check who owns your domain shows how to find it.
  • DNS provider: whoever runs the domain’s nameservers, the servers that hold its DNS records and answer lookups for it. Your registrar’s control panel shows which nameservers the domain uses. If they’re the registrar’s own, your records are there. If they belong to another company, such as Cloudflare or your old web host, that’s where you edit them.
  • Web host: where the website’s files are served from.
  • Email provider: named in your MX records, which tell other mail servers where to deliver email for your domain. For Google Workspace, the MX value is smtp.google.com. If your MX records point at your old web host, your mailboxes are with that host. Ask it what happens to them when the hosting plan ends, and move them first if they’d go with it.

Then make a copy of every DNS record, with a screenshot or an export if your DNS provider offers one. You’ll need it if anything goes missing.

The records you’ll see

  • A points a name at a server’s IPv4 address. AAAA does the same for an IPv6 address.
  • CNAME makes one name an alias of another, such as www pointing at an address the host gives you.
  • MX says where email for the domain is delivered.
  • TXT holds text that other services read. Email uses three kinds: SPF lists the servers allowed to send email from your domain, DKIM publishes the key that proves your emails were signed by you (under a name starting _domainkey), and DMARC tells receiving servers what to do with email that fails those checks (at _dmarc). Google, Microsoft and others also use TXT records to confirm you own the domain.

Only A, AAAA and CNAME records point at the website. MX and TXT records are the ones to protect.

Lower the TTL a day ahead

Every DNS record has a TTL (time to live): the number of seconds other servers may keep a cached copy of it before looking it up again. A record with a TTL of 86400 can stay cached for a day after you change it, so some visitors would still reach the old host.

At least one full TTL before the move, lower the TTL on the website records to 300 (five minutes). On the day, the change then reaches visitors within minutes. You can raise it again once the move is done.

Option 1: keep your DNS where it is

This changes the fewest records. The new host tells you which records to add for the site, for example an A record for the bare domain (yourbusiness.co.uk) and a CNAME for www.

  1. At your DNS provider, change only those website records to the values the new host gave you.
  2. Leave every MX and TXT record alone.
  3. Check the site loads on the new host (see below).

Option 2: move your DNS to the new host

Some hosts ask you to switch the domain’s nameservers to theirs. Once you do, the new provider’s records are the only ones that count, and any record missing from it stops working. Cloudflare’s own setup guide says its automatic scan ‘is not guaranteed to find all existing DNS records’, so check the list yourself.

  1. Add every record from your copy at the new DNS provider before switching, MX and TXT included. Compare the two lists line by line.
  2. If DNSSEC is turned on, turn it off at your registrar first. Cloudflare warns that changing nameservers while DNSSEC is active ‘can cause your domain to become unreachable’. You can turn it on again with the new provider once the domain is active there.
  3. At your registrar, replace the old nameservers with the new ones, copied exactly.
  4. Leave the old DNS records in place. Cloudflare says to allow up to 24 hours for the registrar to update the nameservers, and some lookups will reach the old ones until then.

Check it worked

  • Open the site on your phone over mobile data as well as on Wi-Fi, since each may use a different cached lookup. Check the address starts with https:// and the browser shows no security warning.
  • Send an email to your own address from a different account, then reply from yours.
  • If you changed MX records, give it time. Google says ‘it can take up to 72 hours for the new MX records to be recognized’.

Cancel the old plan last

Wait until the site and email have both worked on the new setup for at least as long as the old TTL, and 72 hours if any MX records changed. Before cancelling, check whether the old plan also covered the domain registration, the DNS or the mailboxes, and move those first. Download a copy of the old site’s files too.

Sources

All guides