How to Connect a Domain to a Website: DNS Records or Nameservers

Quick answer

To connect a domain to a website, add the domain in your website host or builder, then update DNS at your registrar. Either add the A and CNAME records your host gives you, or switch your domain's nameservers to the host. Changes often work within an hour but can take up to 48 hours. Then turn on HTTPS.

The two ways to connect a domain

Your domain lives at a registrar. Your website lives at a host or website builder. DNS is what links the two. There are two common methods:

Method 1: Add DNS recordsMethod 2: Change nameservers
What you doAdd A and/or CNAME records at your current DNS providerReplace your domain’s nameservers with your host’s
Who manages DNS afterwardsYour current provider (often the registrar)Your web host
Effect on emailNone, if you leave MX records aloneEmail records must be recreated at the host
Best forDomains that already have email or other servicesNew domains with nothing else set up
DifficultySlightly more manualSimple, but higher impact

If you’re unsure, use Method 1. It changes only what’s needed for the website.

Before you start

  • Log in details for your registrar (or wherever your DNS is managed).
  • Your host’s or builder’s instructions for connecting a domain. They will list the exact records or nameservers to use.
  • A note of your current DNS records. Take a screenshot so you can undo changes.

Method 1: Point your domain with A and CNAME records

  1. Add the domain in your host or builder. Find the “Domains” or “Custom domain” setting and enter your domain. The host will then show the records it needs.
  2. Open DNS settings at your registrar. Look for “DNS”, “DNS records” or “Manage zone”.
  3. Set the root domain. Add or edit an A record for the bare domain (often written as @) pointing to the IP address your host gives you. Some hosts also give an AAAA record for IPv6. Learn more in what an A record is.
  4. Set the www version. Add a CNAME record for www pointing to the hostname your host gives you.
  5. Remove conflicting records. Delete old A, AAAA or CNAME records for the same names that point to a previous host or a parking page. Leave MX and TXT records for email alone.
  6. Save, then verify in your host’s dashboard. Most hosts have a “Verify” or “Check DNS” button.
Name / HostTypeValue (example)
@A203.0.113.10 (your host’s IP)
wwwCNAMEyoursite.hostexample.com

The values above are placeholders. Always use the exact ones your host provides.

Method 2: Change your nameservers

  1. Add the domain in your host’s dashboard. It will give you two or more nameserver addresses, such as ns1.hostexample.com.
  2. Copy any records you need to keep, especially MX, SPF, DKIM and verification TXT records, into the host’s DNS settings.
  3. At your registrar, find the nameserver setting. Choose “custom nameservers” and replace the existing ones with your host’s.
  4. Save and wait. Nameserver changes can take longer to settle than ordinary record changes.

Read what nameservers are if you want to understand what’s happening behind the scenes.

How long does it take?

New records often work within minutes to an hour. Changes to existing records and nameservers can take longer, commonly up to 48 hours, because DNS answers are cached around the internet for a period set by each record’s TTL. This delay is called DNS propagation. If you plan a switch, lowering the TTL a day beforehand can speed it up.

After it connects

  1. Turn on HTTPS. Most hosts issue a free SSL certificate automatically once DNS points to them. See what an SSL certificate is.
  2. Choose one main version. Decide between www and non-www and redirect the other to it. Google recommends consolidating duplicate URLs so search engines index one version.
  3. Test both addresses (example.com and www.example.com) on a phone using mobile data, which bypasses your home network’s DNS cache.

Troubleshooting

ProblemWhat to check
Old site or parking page still showsConflicting old records, or caches still updating
“Domain not configured” error from hostDomain not added in the host’s dashboard
Works with www but not without (or vice versa)Missing A record for @ or CNAME for www
Security warning in the browserSSL certificate not issued yet; wait or re-trigger it in your host
Email stopped workingNameservers changed without copying MX records

Online DNS lookup tools let you see what records the wider internet currently sees for your domain, which helps confirm whether a problem is propagation or a mistake.

Just bought your domain? Our guide to how to build a website covers choosing a host or builder before you connect it.

Frequently asked questions

Should I change nameservers or add DNS records?

Adding records keeps DNS at your current provider and leaves email and other services untouched, so it's usually the safer choice. Changing nameservers is simpler when the host manages everything, but you must recreate any existing records, especially email, at the new provider.

Why isn't my domain working after I connected it?

Usually it's waiting for DNS caches to update, a typo in a record, an old record that conflicts with the new one, or the domain not being added inside the host's dashboard. Check each in turn.

Will connecting my domain affect my email?

Changing A or CNAME records for your website doesn't affect email. Changing nameservers can, because your MX and other email records must be copied to the new DNS provider.

Do I need to transfer my domain to my web host?

No. You can keep the domain at any registrar and point it at any host with DNS. Transferring is optional and mainly about convenience.

Sources

  1. Cloudflare Learning Center: What is DNS?
  2. Cloudflare Learning Center: DNS records
  3. Google Search Central: Consolidate duplicate URLs
Editorial Team

Plain-language guides to domain names and building websites. Articles are drafted with AI and list their sources; some are also reviewed by a person with domain-industry experience.