Skip to content
Hosting and infrastructure

DNS Records Explained: Connect a Domain to Hosting and Email

What nameservers, A, CNAME, MX, TXT and CAA records actually do, and the exact records to connect your domain to shared hosting, Shopify or Webflow without breaking email.

Harsh PrajapatiFull stack developer
Published
Reading time
8 min

DNS Records Explained: Connect a Domain to Hosting and Email

DNS records are the settings that tell the internet where your domain's website and email live. Nameservers decide which company holds those records, and the records themselves do the pointing: an A record sends the domain to a web server's IP address, a CNAME points a name like www to another name, MX records route email, and TXT records prove ownership and protect email. To connect a domain, you add the records your host or platform gives you at whichever company your nameservers point to, and leave the email records alone unless email is moving too.

Most "my website is down" and "my email stopped" problems after a domain change come from one wrong or missing record, or from editing records at a company that is no longer in charge of them. This guide explains each record type in plain words, gives a settings table you can keep, and shows the exact records for connecting a domain to shared hosting, Shopify, Webflow and Google Workspace.

#Nameservers and records: two different things

Your domain has two layers of settings, and mixing them up is the most common source of confusion.

Nameservers are set at the registrar, where you bought the domain. They say which company's DNS servers answer questions about your domain. That might be the registrar itself, your web host, or a DNS provider such as Cloudflare.

DNS records are set at whichever company the nameservers point to. They are the actual answers: this domain's website is at this IP address, its email goes to these servers, and so on.

If your nameservers point to Cloudflare, changing records at the registrar does nothing, because nobody is asking the registrar any more. Always check the nameservers first, then edit records in the right place.

  1. Registrar sets nameservers
  2. DNS host holds the records
  3. A and CNAME find the website
  4. MX finds the mail server
  5. TXT proves ownership and protects email

There are two ways to connect a domain to a new service:

  1. Change the nameservers to the new host's. Simple, but every record now lives at the new host, so email and other records must be recreated there first.
  2. Keep the nameservers and change only the needed records. More control, and email is untouched. This is usually the safer route for businesses.

#DNS records settings table

Keep this table as a reference. Values are examples; always use the ones your provider gives you.

RecordWhat it doesName (host)Example value
APoints a name to an IPv4 address@ or www203.0.113.10
AAAAPoints a name to an IPv6 address@2001:db8::10
CNAMEPoints a name to another namewwwexample.com or a platform address
MXSends email to a mail server, with a priority number@smtp.google.com, priority 1
TXTHolds text: SPF, DKIM, DMARC, ownership checks@, _dmarc or a selectorv=spf1 include:... ~all
CAALists which certificate authorities may issue SSL certificates@0 issue "letsencrypt.org"
NSNames the DNS servers for a domain or subdomain@ or a subdomainns1.example-host.com

@ means the root domain itself (example.com). Some DNS panels want the full name instead, such as www.example.com, and some want a trailing dot on names that are values, such as shops.myshopify.com.. Check your DNS host's help page if a record will not save.

#Each record type in plain words

#A and AAAA

An A record points a name to an IPv4 address, and an AAAA record does the same for an IPv6 address. Your root domain almost always uses an A record, because it needs a fixed address. If a platform gives you both, add both; if it gives only an A record, delete any old AAAA records, or some visitors will reach the old server.

#CNAME

A CNAME says "this name is an alias for that name". It is ideal for www and subdomains that point at a platform, because the platform can change its IP addresses without you editing anything. The DNS standard (RFC 1034) says that when a CNAME exists on a name, no other records should exist on that same name, which is why you normally cannot put a CNAME on the root domain where your MX and TXT records live. Some DNS hosts, including Cloudflare, offer CNAME flattening to get around this at the root; see Cloudflare for business websites if you are considering it.

#MX

MX records tell other mail servers where to deliver email for your domain. Each has a priority number, and lower numbers are tried first. Google Workspace, for example, asks for a single MX record with the value smtp.google.com and priority 1, and tells you to remove any other MX records. Change MX records only when you are moving email; this is the record that makes email stop when it goes wrong.

#TXT

TXT records hold short pieces of text. Most of them do one of two jobs: proving to a service that you own the domain (Webflow, Google and Microsoft all use them), or email authentication with SPF, DKIM and DMARC. Do not delete TXT records you do not recognise until you know what they are for. My article on domain and business email setup explains why they matter, and the SPF, DKIM and DMARC setup guide gives the records step by step.

#CAA

A CAA record lists which certificate authorities may issue SSL certificates for your domain. RFC 8659, the standard for CAA, says a compliant certificate authority must check for it before issuing. It is a useful safety setting, but if you add one, include every authority you use. A CAA record that names only one authority will block the free certificate a new host or platform tries to issue from another one. My article on SSL certificates, free vs paid covers the certificate side.

#TTL

TTL (time to live) is how long, in seconds, other servers may cache a record before asking again. Cloudflare's automatic TTL is 300 seconds (five minutes). Lower the TTL a day or so before a planned change so the switch spreads quickly, and raise it again afterwards if your host recommends it. Shopify and Google both say you can leave TTL at the default when you first connect.

#Connecting your domain: three common examples

These examples assume you keep your current nameservers and edit records at your DNS host.

#1. Shared hosting (cPanel and similar)

Your host gives you either its nameservers or its server's IP address.

  1. Find the server IP in your hosting dashboard or welcome email.
  2. Edit the A record for @ to that IP.
  3. Set www as a CNAME to your root domain, or as an A record to the same IP.
  4. Leave MX and TXT records alone if your email is with Google Workspace, Microsoft 365 or another provider.
  5. If your email is hosted with the web host, add the MX, SPF and DKIM values from the host's email settings.

#2. Shopify

Shopify's help centre lists these records for connecting a third-party domain manually:

TypeNameValue
A@23.227.38.65
AAAA@2620:0127:f00f:5::
CNAMEwwwshops.myshopify.com.

Shopify says to remove other A and AAAA records on the domain, keep only one A record and one www CNAME, and allow up to 48 hours for the domain to be fully live.

#3. Webflow

Webflow's help centre lists these records for a manual connection:

TypeNameValue
A@198.202.211.1
CNAMEwwwcdn.webflow.com
TXT_webflowThe one-time-verification= value shown in your site settings

Your own site settings page shows the exact values for your site, so copy them from there rather than from an old tutorial.

#When to get help

Editing one A record for a new site is a reasonable job to do yourself. Get help when you are changing nameservers on a domain that runs business email, when email is already landing in spam, when several services send email as your domain, or when you are moving the domain, the hosting and the email at the same time. A single wrong MX or TXT record can stop invoices and enquiries for days before anyone notices.

My domain, DNS and Cloudflare setup service covers record changes, Cloudflare and SSL, and hosting, domain and email setup covers a full new setup. If the domain is also changing registrar, follow my domain transfer guide, and if the website is moving hosts, see how to move a website without downtime.

Frequently asked questions

What is the difference between nameservers and DNS records?

Nameservers decide which company hosts your DNS, and DNS records are the individual settings held there. You set nameservers at the registrar, and you edit records at whichever company those nameservers point to.

Should I use an A record or a CNAME?

Use an A record for the root domain and a CNAME for www and other subdomains when your platform gives you a hostname. A CNAME cannot share a name with other records, so it usually cannot go on the root domain unless your DNS host offers CNAME flattening.

Why is my domain not connecting after I changed the records?

The usual causes are editing records at the wrong company because the nameservers point elsewhere, leaving an old A or AAAA record in place, a typo in the value, or a long TTL that keeps the old answer cached. Check the nameservers first, then compare each record with the provider's instructions.

Will changing DNS records affect my email?

Changing A and CNAME records for the website does not affect email. Email depends on MX records and the SPF, DKIM and DMARC TXT records, so it is only affected if those are changed or lost, for example when nameservers move without copying them.

How long do DNS changes take?

It depends mainly on the TTL of the old record: other servers can keep the old answer until that time runs out, so a five-minute TTL spreads far faster than a one-day TTL. Some providers, such as Shopify, say to allow up to 48 hours for a new domain connection to be fully live.

Sources

The facts in this article were checked against these pages, last reviewed 12 November 2026.

  1. DNS record types, Cloudflare DNS docsdevelopers.cloudflare.com/dns/manage-dns-records/reference/dns-record-types/
  2. Time to Live (TTL), Cloudflare DNS docsdevelopers.cloudflare.com/dns/manage-dns-records/reference/ttl/
  3. RFC 1034: Domain names, concepts and facilitiesrfc-editor.org/rfc/rfc1034
  4. RFC 8659: DNS Certification Authority Authorization (CAA) Resource Recordrfc-editor.org/rfc/rfc8659
  5. Connecting a third-party domain manually, Shopify Help Centerhelp.shopify.com/en/manual/domains/add-a-domain/connecting-domains/connect-domain-manual
  6. Manually connect a custom domain, Webflow Help Centerhelp.webflow.com/hc/en-us/articles/33961239562387-Manually-connect-a-custom-domain
  7. Set up MX records for Google Workspace, Google Workspace Admin Helpknowledge.workspace.google.com/admin/domains/set-up-mx-records-for-google-workspace
Harsh Prajapati, the author

Written by

Harsh Prajapati

Freelance full stack developer, founder of Worklancio

Web developer since 2018, freelancing since 2022. Builds WordPress sites and plugins, web apps and CRMs from Ahmedabad.

You may also like