To point a domain to hosting, sign in where your domain's DNS is managed (usually the registrar) and add two records with your host's values: an A record for the root domain with the host's IP address, and a CNAME record for www with the host's hostname. If the host asks for its nameservers instead, switch them at the registrar after copying your email records to the new DNS host. The change shows within minutes to hours, set by the old record's TTL; check it with a DNS lookup, then turn on HTTPS at the host.
This guide is for anyone whose domain is registered with one company while the site lives with another. The steps are the same at every registrar and only the field names differ. The exact values always come from your host.
Before you start: find where your domain's DNS is managed
Do four things before you edit a single record. The second one decides whether your edits do anything at all.
- Add the domain at your host first. The host then shows the values to use: an IP address, a hostname or a pair of nameservers. Porkbun's guide to pointing a domain starts there too: "you'll need to first obtain the IP address or addresses of your web server from your web hosting company."
- Find out which company answers DNS for the domain today. Look up its nameservers with
dig +short NS example.com(the check section below has the Windows version) or on the registrar's domain page. Records only work at the provider those nameservers name. Namecheap's help says its A records can be set "only if the domain is using our BasicDNS/PremiumDNS/FreeDNS nameservers", and the same holds for every DNS host: if the nameservers point to Cloudflare or an old host, records edited at the registrar change nothing.
- Save a copy of the current records. Export the zone file if your provider offers one, or take screenshots, so you can undo any change.
- Lower the TTL a day ahead on the records you plan to change. The TTL section below explains why.
Pointing is not the same as transferring. A transfer moves the domain's registration to another registrar; you don't need one to connect a host, and the domain can stay where it is.
DNS records or nameservers: two ways to connect a domain to a host
You can connect a domain to a host in two ways, and the difference is who runs your DNS afterwards. Porkbun's guide names both: "The first is assigning your web host's DNS nameservers which puts your web host in charge of the DNS for your domain. The second method is pointing your domain to hosting with A records, which keeps DNS management at Porkbun."
The two methods also differ in how much of your DNS they touch. With records, you add or change two or three entries, and everything else in the zone, email included, stays as it is. With nameservers, the new provider answers for the whole domain, so every record you still need has to exist there before the switch.
Use records unless one of two things applies. Some hosting plans require their own nameservers: Namecheap, for example, tells customers on its Stellar shared hosting plans to "point the domain to our Web Hosting DNS nameservers". Or you want the host or a CDN to run all of your DNS: Cloudflare's full setup, which moves your nameservers to Cloudflare, is "the only one available for Free or Pro plans".
This table puts the two methods side by side:
| Method | What you change | Who runs DNS afterwards | Your email records | Use it when |
|---|---|---|---|---|
| DNS records | An A record at the root, a CNAME at www | The same provider as today | Untouched | The host gives you an IP address or a hostname |
| Nameservers | The nameserver set at your registrar | Your host or CDN | Copied to the new DNS host first | The host requires it, or you want it to run all your DNS |
Point the root domain with an A record
The root domain (example.com, also called the apex) points to your host through an A record holding the host's IPv4 address. At your DNS provider, take these four steps:
- Delete old records at the root that point elsewhere. Porkbun says to remove "any ALIAS, CNAME, or A records that are currently pointing at the wrong web server", along with its own default records. Namecheap says the parking-page records it sets on a newly registered domain "should always be removed after setting up custom host records for your domain". An old A record left beside the new one sends some visitors to the old server.
- Add an A record with
@in the Name or Host field, or with the field left blank: Namecheap uses@, Porkbun leaves it blank. - Enter the host's IP address as the value, with a short TTL such as 300 seconds. Add one A record per address if the host gives several.
- If the host gives an IPv6 address, add an AAAA record the same way, and delete any old AAAA record that points to the previous host.
The root records, with values reserved for documentation (RFC 2606, RFC 5737, RFC 3849) in place of your host's:
| Type | Name | Value | TTL | When to add it |
|---|---|---|---|---|
| A | @ | 192.0.2.10 | 300 | Always |
| AAAA | @ | 2001:db8::10 | 300 | Only if the host gives an IPv6 address |
Why the root domain can't use a CNAME
The root domain can't use a CNAME because a name that holds a CNAME can hold nothing else, and the root always holds other records. The DNS standard RFC 1034 says "If a CNAME RR is present at a node, no other data should be present", and RFC 1912 repeats it: "A CNAME record is not allowed to coexist with any other data." DNSimple's guide to A and CNAME records spells out what that means for your domain: "The root always needs SOA and NS records, and usually MX records, and none of them can exist alongside a CNAME." So the root takes A or AAAA records, while www, which holds nothing else, can take a CNAME.
When the host gives a hostname instead of an IP
When your host gives only a hostname for the root domain, use your DNS provider's record for exactly that case: an ALIAS record or CNAME flattening. DNSimple offers "the ALIAS record for this case"; Namecheap's help says its ALIAS record "can also be used if you wish to alias the root domain to another service"; and Cloudflare's CNAME flattening "allows you to use a CNAME record at your zone apex" by looking up the address the CNAME points to and returning that address. If your provider offers none of these, use the host's nameservers.
Check the target before you rely on flattening. When the target name has no A or AAAA record, flattening returns an empty answer, and Cloudflare warns: "This can make it appear as if the DNS record is not propagating."
Point www with a CNAME record
Point www with a CNAME record that holds the hostname your host gives you. Resolvers follow the CNAME to that name and use its address, so when the host changes its IP addresses, your www record keeps working without an edit. DNSimple recommends a CNAME in that situation, when the target "hostname's IP address might change".
First delete any old A or CNAME record at www, since a CNAME can't share its name. Then add a record with Type CNAME, Name www and the host's hostname as the value (or the root domain, if the host says so).
If the host gives only an IP address, use an A record at www too. That is how Porkbun's example does it, with one A record for www and one for the root, and its note adds that a host "may give you a CNAME record to add to your domain, rather than two separate A records". Enter whichever your host specifies.
Both forms, with yoursite.host.example in place of your host's hostname:
| Type | Name | Value | TTL | When to add it |
|---|---|---|---|---|
| CNAME | www | yoursite.host.example | 300 | The host gives a hostname |
| A | www | 192.0.2.10 | 300 | The host asks for an A record at www |
Together with the root records, that is the whole setup for most sites. Add both example.com and www.example.com at your host as well and let it redirect one to the other, so every visitor lands on one address. Cloudflare's setup guide describes the same pattern: www "will usually point to the same content as what you have on the apex domain (example.com) or use a redirect".
Switch nameservers without losing your email
Switch nameservers only once the new DNS host holds every record you still need. After the switch, that host answers for the whole domain, so a record missing there stops working: mail sent to your domain has no MX record to follow, and SPF, DKIM and verification records vanish with it.
Copy these records before you switch
Import tools help, but don't trust them alone: Cloudflare's own guide warns that "the quick scan is not guaranteed to find all existing DNS records". Before you change the nameservers, check that each of these exists at the new DNS host with the same name and value:
- MX records, which tell other mail servers where to deliver your email.
- SPF, a TXT record at the root whose value starts with
v=spf1. - DKIM, TXT records under a selector name that ends in
._domainkey. - DMARC, a TXT record named
_dmarc. - Verification records, the TXT or CNAME records that search, email or app providers asked you to add to prove you own the domain.
- Everything else in the old zone: subdomains, SRV records and CAA records, if you have them.
Then compare the old and new lists line by line. Any record that appears only in the old list stops working after the switch, so add it at the new DNS host first.
Change the nameservers at your registrar
At your registrar, replace every nameserver with the set your new host gives you, and never keep a mix of old and new. Cloudflare's guide says to remove the existing ones and warns: "If their names are not copied exactly, your DNS will not resolve correctly."
If DNSSEC is on at the registrar, turn it off before the switch. Cloudflare's guide explains why: "Changing nameservers while DNSSEC is active can cause your domain to become unreachable." The same guide has you re-enable DNSSEC through Cloudflare "after your domain is active", so turn it back on at your new DNS host once the domain works.
Keep the old DNS zone until lookups show the new nameservers, because resolvers that cached the old ones still ask the old provider. Expect this change to be slow: Cloudflare allows up to 24 hours for the registrar's update, and the .com registry served its delegation record with a TTL of 172,800 seconds (48 hours) when we queried a.gtld-servers.net on October 30, 2026. Other domain endings set their own values.
How long DNS changes take and what TTL has to do with it
A DNS change shows once the old answer's TTL runs out, not after a fixed 24 to 48 hours. Nothing is pushed around the world: resolvers, the DNS servers your visitors' devices ask, keep each answer for its TTL (time to live, in seconds), then ask again. Tiger Computing's explainer on the myth of DNS propagation does the arithmetic: at 86,400 seconds, a typical TTL, "DNS servers around the planet may take up to 24 hours to reflect any changes".
Because the wait depends on the TTL, you can shorten it ahead of time. At least one old TTL before the change (a day ahead covers 86,400 seconds), lower the TTL on the records you will edit to 300 seconds, as Tiger Computing suggests. Make the change, check it, then raise the TTL again. Even then, Cloudflare's TTL reference warns that "your local DNS cache may take longer to update".
Both ends of the usual estimate do happen: GoDaddy's guide to connecting a domain says changes take "a few minutes to several hours (rarely up to 48 hours)". The TTL decides where in that range a change lands: minutes after a short TTL, hours after a long one, and up to 48 hours for a .com nameserver change, which waits on the registry's TTL. Tiger Computing adds that some ISPs "cache for long periods regardless of the TTL value", which no setting of yours can fix.
You can still clear your own caches, so you see the change sooner. On Windows, ipconfig /flushdns empties the computer's DNS cache (Microsoft's ipconfig reference); elsewhere, restart the browser and the device. Google Public DNS has a Flush Cache page for its own resolver, and after a nameserver change Google says to "flush the main domain name first before flushing subdomains". Other networks' caches clear on their own schedule.
Check the change with a DNS lookup
A lookup shows what DNS answers right now, so you can check the change instead of waiting it out.
Look up the records from your computer or browser
Run these in a terminal, with your own domain in place of example.com. On macOS or Linux, use dig, documented in the BIND manual:
dig +short example.com A
dig +short www.example.com
dig +short NS example.com
dig @ns1.example.net example.com A
The first two show the addresses the root and www lead to, and the third shows which nameservers answer for the domain. The last one asks a single nameserver directly, so replace ns1.example.net with one of your DNS host's nameservers: you see what is saved there, before any cache.
On Windows, nslookup does the same job, and Microsoft's nslookup reference explains that an optional second argument names the DNS server to ask:
nslookup example.com
nslookup -type=ns example.com
nslookup example.com ns1.example.net
If you have no terminal, Google Admin Toolbox Dig runs the same lookups in a browser. To see what resolvers in other places return, a checker such as whatsmydns.net queries many locations at once, though Cloudflare notes that "most of these tools use cached query results", so they can trail the real state. Once the answers show your new host, open the site in a private window to confirm it loads from there.
Why the lookup still shows the old host
When a lookup still returns the old host after the old TTL has run out, check these five causes:
- The records were edited at the wrong provider. If
dig +short NSnames a different company from the one you edited, make the changes there. - An old record is still at the root. An old A record beside the new one sends some visitors to each server, and an old AAAA keeps IPv6 visitors on the previous host. Delete both.
- www still points to the old host, through an old A record or a CNAME to the old hostname.
- The domain is in the Name field twice. Namecheap notes that some DNS systems, its own included, "have the tendency to automatically add the domain name to the values submitted during record creation", so typing www.example.com can create www.example.com.example.com. Enter only
www. - The CNAME or ALIAS target has no address of its own. Look up the target name itself; if it returns nothing, ask the host for the correct one.
Fix the cause, wait one TTL, and look up again.
Turn on HTTPS after the domain points to the new host
HTTPS comes last because the certificate check runs through the domain itself. In the HTTP-01 challenge, which Let's Encrypt calls "the most common challenge type today", the host puts a file on its web server at http://example.com/.well-known/acme-challenge/{token}, and Let's Encrypt "tries retrieving it". While the domain still points to the old host, that request reaches the old server, the file isn't there, and no certificate is issued.
So wait until the lookups show your new host on both names, then turn on or request the certificate at your host. Two more things decide whether it works.
First, add both example.com and www.example.com at the host, because a certificate covers only the names listed in it. Let's Encrypt's glossary calls that list the Subject Alternative Name, the field "that indicates for which domain(s) the certificate is valid", so a name left off it has no valid certificate.
Second, check for a CAA record, a DNS record that, in Let's Encrypt's words, "allows site owners to specify which Certificate Authorities (CAs) are allowed to issue certificates containing their domain names". When your zone has one, only the authorities it names may issue, and Let's Encrypt checks CAA records before every certificate it issues. So look up which authority your host uses in its documentation, then add that authority to the record or remove the record.
Once the certificate is active, turn on the host's HTTPS redirect, so every visit uses the secure address.
Which way to connect your domain
For most sites, connect the domain with records: keep your nameservers where they are, add an A record for the root and a CNAME for www with the values your host gives, and nothing else in the domain changes. Switch nameservers only when the host requires it or you want the host or a CDN to run all of your DNS, and only after the MX and TXT records exist at the new DNS host. Either way, lower the TTL a day ahead and end the wait with a lookup rather than a guess.
If you still need a host, our guide to hosting a static website for free covers the records GitHub Pages, Netlify and Cloudflare Pages ask for, and if the site's files are not on the host yet, our guide to uploading a website with FTP covers that step.
Sources
- RFC 1034: Domain Names, Concepts and Facilities
- RFC 1912: Common DNS Operational and Configuration Errors
- RFC 2606: Reserved Top Level DNS Names
- RFC 5737: IPv4 Address Blocks Reserved for Documentation
- RFC 3849: IPv6 Address Prefix Reserved for Documentation
- Cloudflare: Set up a primary zone (Full setup)
- Cloudflare: CNAME flattening
- Cloudflare: Time to Live (TTL)
- DNSimple: Differences Between A and CNAME Records
- Porkbun: Pointing Your Domain to Hosting With A Records
- Porkbun: How to Set Up URL Forwarding
- Namecheap: How to Connect a Domain to a Server or Hosting
- Namecheap: How to Create a Subdomain for my Domain
- GoDaddy: How to connect a domain name to your hosting account
- Tiger Computing: The Myth of DNS Propagation
- Google Public DNS: Flush Cache
- Microsoft Learn: ipconfig
- Microsoft Learn: nslookup
- BIND 9 Administrator Reference Manual: manual pages (dig)
- Let's Encrypt: Challenge Types
- Let's Encrypt: Glossary
- Let's Encrypt: Certification Authority Authorization (CAA)
Frequently Asked Questions
How do I host a website if I have a domain?
Get a place to host the site's files, then point the domain at it. A domain is only an address: the site itself needs a host, either a paid hosting plan or a free static host for a site made of plain HTML files.
Upload the files to the host, add the domain in the host's dashboard, then add the A and CNAME records (or the nameservers) the host gives you at the company that manages your DNS, as this guide describes.
How do I point my domain to another website?
Use your registrar's URL forwarding rather than a DNS record. A redirect is an HTTP response that a web server sends, while an A or CNAME record only tells browsers which server to ask, so DNS records alone can't send visitors on to a page on another site. Porkbun's URL forwarding guide is a typical example: its free service forwards "all visitors to your domain to an existing site", uses a temporary 302/307 redirect by default and offers a 301 permanent redirect in its advanced settings.
Porkbun also says to remove the DNS records of a previous web host before you create the forward, because they conflict with it. If you want a site hosted elsewhere to show at your own address instead, that is pointing, and the records in this guide do it.
What is the difference between an A record and a CNAME?
An A record maps a name to an IPv4 address; a CNAME maps a name to another name, whose own records then supply the address. DNSimple's comparison gives the practical difference: a CNAME suits a name whose target "hostname's IP address might change", because it follows the target, but it can't sit beside any other record at the same name. That is why the root domain takes an A record and www often takes a CNAME.
Can you have a CNAME and an A record with the same name?
No. RFC 1912 says "A CNAME record is not allowed to coexist with any other data", which rules out an A, MX or TXT record at any name that has a CNAME. If you need an alias at the root domain, where other records always exist, use your DNS provider's ALIAS record or CNAME flattening instead.
How can I speed up DNS propagation?
You can't push a change out faster, but you can shorten the wait before you make it. Lower the TTL on the records you will change to 300 seconds at least one old TTL ahead (a day covers the common 86,400 seconds), so caches that respect the TTL drop the old answer within five minutes of the change.
After the change, flush your own computer's DNS cache and use Google Public DNS's Flush Cache page for that resolver. A nameserver change still waits on the registry's TTL, which was 48 hours for .com when we checked on October 30, 2026.





