How to Point a Domain to Your Hosting: Nameservers, A Records and CNAMEs
The two ways to connect a domain to your hosting, changing nameservers or editing A and CNAME records, with step-by-step instructions and common mistakes to avoid.
After buying a domain and a hosting plan, you need to connect them so the domain opens your website. There are two ways to do it: hand the whole DNS zone to your host by changing the nameservers, or keep DNS where it is and add records that point to the host’s server. Both work. The right choice depends on who you want to manage your DNS.
- Changing nameservers moves all DNS management to the new provider, so every record must exist there.
- Editing A and CNAME records points only the website, leaving email and other records untouched.
- Changes can take from minutes to a day to reach everyone, depending on TTL and caching.
Method 1: Change the nameservers
Your host gives you two or more nameserver names, such as ns1.examplehost.com and ns2.examplehost.com. At your registrar, open the domain’s settings, choose to use custom nameservers, and replace the existing ones with your host’s.
From then on, the host’s DNS servers answer for your domain. Most hosts create the basic website records automatically. Before you switch, copy any records you rely on from the old DNS provider, especially:
- MX records for email (for example if you use a separate email service).
- TXT records such as SPF, DKIM, DMARC and verification codes for search, ads or email tools.
- CNAME records for subdomains that point to other services, such as a shop, help desk or newsletter tool.
Choose this when: you want one place to manage hosting and DNS, or the host requires it for features such as automatic SSL or a built-in CDN.
Method 2: Point records to the host
Keep your current nameservers and edit the records instead. Your host will give you the server’s IP address, and sometimes a hostname.
- In the DNS editor at your registrar or DNS provider, find the record for the root domain, shown as
@or left blank. - Set an A record for
@to the host’s IPv4 address. If the host gives an IPv6 address, add an AAAA record as well. - Set
wwwas a CNAME pointing to your root domain (or to the hostname the platform gives you). Alternatively, set an A record forwwwto the same IP. - Remove old A or AAAA records for the same names that point to a previous server; leftover records make some visitors land on the old site.
Choose this when: you use a separate DNS service, your email is set up elsewhere and you do not want to risk it, or you only want a subdomain to point to the host.
The root domain and CNAME
DNS rules do not allow a normal CNAME at the root of a domain (example.com) alongside other records such as MX. That is why the root usually uses an A record. Some DNS providers offer workarounds named ALIAS, ANAME or “CNAME flattening” that act like a CNAME at the root. Use them when a platform gives you a hostname rather than a fixed IP address.
Check that it worked
- Use an online DNS lookup tool to see what different resolvers around the world return for your domain.
- On your computer, the command
nslookup example.comordig example.comshows the current answer. - Once the domain points to the host, issue or confirm the SSL certificate and test both
example.comandwww.example.com. - Pick one main version (with or without
www) and redirect the other to it.
Common mistakes
- Switching nameservers without recreating MX records, so email stops arriving.
- Typing the IP address with an extra space or digit.
- Forgetting the
wwwrecord, so only one version of the address works. - Leaving a high TTL before a planned change, so the switch takes longer.
- Adding records at the registrar while the domain actually uses another company’s nameservers. Records only take effect where the active nameservers are.
Frequently asked questions
How long does it take for a domain to point to new hosting?
Record changes often show within minutes to a few hours. Nameserver changes can take longer, sometimes up to 24 to 48 hours, because the parent zone’s records are also cached.
Which method is better?
Neither is better in general. Nameservers are simpler if the host manages everything; editing records is safer if email and other services already work through your current DNS.
How do I find which nameservers my domain uses now?
Use a WHOIS lookup or a DNS lookup for NS records. The answer tells you where to make changes.



