UndieGravity LogoUndiegravity

Connect a Custom Domain: DNS Records Explained Simply

A, CNAME, and TXT records in plain words, root versus www domains, how long DNS changes take, and how to connect a domain to Vercel, Netlify, or Pages.

By UndieGravity, , 2 min read

Your site is deployed at an address like my-site.netlify.app, and you want example.com instead. Connecting them means adding a few DNS records at the company where you bought the domain. It looks technical, but there are only three record types you need to know.

What DNS does

DNS is the internet's address book. When someone types your domain, their browser asks DNS where to go, and your records give the answer: an IP address or another host name.

The three records you need

  • A record: points a name to an IPv4 address, such as 76.76.21.21. Used for the root domain (example.com).
  • CNAME record: points a name to another name, such as my-site.netlify.app. Used for subdomains like www.
  • TXT record: holds text, usually to prove you own the domain (for hosting, email, or Search Console).

Root domain versus www

A root domain cannot normally use a CNAME, so it uses A records. Some DNS providers offer ALIAS or ANAME records, or CNAME flattening, which act like a CNAME at the root. Your host's instructions say which to use.

Pick one main address and redirect the other to it. Most hosts set this up when you add both versions in their dashboard.

Step by step

  1. Add the domain in your host's dashboard (Vercel, Netlify, or GitHub Pages settings).
  2. Copy the records the host shows you.
  3. At your registrar, open the DNS settings and add those exact records. Delete old records for the same names that point elsewhere.
  4. Wait, then check the host's dashboard until the domain shows as verified.
  5. HTTPS is issued automatically once the domain points to the host.

How long does it take?

Often a few minutes, sometimes up to 48 hours. Each record has a TTL (time to live) that says how long other servers may cache the old answer. Lower the TTL a day before a planned move to make the switch faster.

Do not break your email

If you use email on the same domain, leave the MX records and any email TXT records (SPF, DKIM) alone. Changing website records does not affect email unless you delete those.

Check your records

nslookup example.com
nslookup -type=CNAME www.example.com

Keep reading

Deployment

Deploy a Next.js Site to Vercel in 10 Minutes

Step by step: push your Next.js project to GitHub, import it into Vercel, add environment variables, connect a custom domain, and know the Hobby plan limits.

, 2 min read

Deployment

Deploy HTML and Next.js Sites to Netlify

Deploy to Netlify by dragging a folder for HTML sites or connecting Git for Next.js and React. Build settings, forms without a backend, and free plan basics.

, 1 min read

Deployment

Host an HTML Website for Free on GitHub Pages

Publish an HTML template on GitHub Pages for free: create a repository, turn on Pages, add a custom domain with HTTPS, and know the size and usage limits.

, 1 min read