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 records | Method 2: Change nameservers | |
|---|---|---|
| What you do | Add A and/or CNAME records at your current DNS provider | Replace your domain’s nameservers with your host’s |
| Who manages DNS afterwards | Your current provider (often the registrar) | Your web host |
| Effect on email | None, if you leave MX records alone | Email records must be recreated at the host |
| Best for | Domains that already have email or other services | New domains with nothing else set up |
| Difficulty | Slightly more manual | Simple, 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
- 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.
- Open DNS settings at your registrar. Look for “DNS”, “DNS records” or “Manage zone”.
- 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. - Set the www version. Add a CNAME record for
wwwpointing to the hostname your host gives you. - 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.
- Save, then verify in your host’s dashboard. Most hosts have a “Verify” or “Check DNS” button.
| Name / Host | Type | Value (example) |
|---|---|---|
@ | A | 203.0.113.10 (your host’s IP) |
www | CNAME | yoursite.hostexample.com |
The values above are placeholders. Always use the exact ones your host provides.
Method 2: Change your nameservers
- Add the domain in your host’s dashboard. It will give you two or more nameserver addresses, such as
ns1.hostexample.com. - Copy any records you need to keep, especially MX, SPF, DKIM and verification TXT records, into the host’s DNS settings.
- At your registrar, find the nameserver setting. Choose “custom nameservers” and replace the existing ones with your host’s.
- 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
- Turn on HTTPS. Most hosts issue a free SSL certificate automatically once DNS points to them. See what an SSL certificate is.
- 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.
- Test both addresses (example.com and www.example.com) on a phone using mobile data, which bypasses your home network’s DNS cache.
Troubleshooting
| Problem | What to check |
|---|---|
| Old site or parking page still shows | Conflicting old records, or caches still updating |
| “Domain not configured” error from host | Domain 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 browser | SSL certificate not issued yet; wait or re-trigger it in your host |
| Email stopped working | Nameservers 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