To connect a custom domain, you add a few records at the company that runs your domain’s DNS. Usually that means an A record (or an ALIAS) for the bare domain, a CNAME for www, and sometimes a TXT record to prove you own it. Your host tells you the exact values. Then you wait a few minutes, check, and turn on HTTPS.
That is the whole job. The rest of this guide explains each piece in plain words, so you know what you are clicking and how to fix it when something looks wrong.
- DNS is the internet’s address book. Records tell browsers where your site lives.
- You usually need an A or ALIAS record for
example.comand a CNAME forwww.example.com. - Your host’s domain settings page gives you the exact values. Copy them, do not guess.
- Most changes show up within minutes to a few hours. A lower TTL makes the next change faster.
- Check your work with one command (
dig) instead of refreshing a browser.
What DNS actually does
When someone types your domain, their device asks a DNS resolver for the answer. The resolver asks your domain’s nameservers, which hold your records. Then it caches the answer for a while, so the next visitor gets it instantly.
That caching is why changes are not always instant. It is also why you should never panic in the first ten minutes.
The four records you will actually touch
Most hosts only ever ask for a few record types. Here is what each one means.
| Record | What it does | Example value | When you need it |
|---|---|---|---|
| A | Points a name at an IPv4 address | 203.0.113.10 | Your host gives you an IP address |
| AAAA | Points a name at an IPv6 address | 2001:db8::10 | Your host gives you an IPv6 address |
| CNAME | Points a name at another name | yoursite.host.app | Your host gives you a hostname, usually for www |
| TXT | Holds text, often a verification code | host-verify=abc123 | Your host asks you to prove you own the domain |
Two more show up now and then. MX records decide where your email goes, so leave them alone unless you are changing email providers. CAA records list which certificate authorities may issue certificates for your domain. They are optional hardening.
Records or nameservers: pick your approach
There are two ways to connect a domain. You can add a few records where your DNS already lives, or you can move your whole DNS to your host by changing nameservers.
| Add records where DNS lives now | Switch nameservers to your host | |
|---|---|---|
| What changes | Two or three records | Your whole DNS zone moves |
| Email and other records | Stay exactly as they are | Must be recreated at the new provider |
| Best when | The domain already has email or other services | The domain is brand new |
| How to undo | Delete the records | Switch back, which is slower to take effect |
If your domain already sends or receives email, adding records is the safer choice. Changing nameservers without copying your MX and TXT records is the most common way people break their email on launch day.
Connect your domain in six steps
Find the exact values your host wants
Open your host’s domain or custom domain settings and add your domain there first. The page will list the records to create, with exact values. Copy them into a note. Hosts differ, so a value from a tutorial is not a substitute. If you have not picked a host yet, where to deploy your app compares nine of them.
Find out where your DNS lives
Your DNS is not always at the company where you bought the domain. Ask the internet which nameservers answer for it:
Terminal dig +short NS example.comIf the answer names your registrar, log in there. If it names another provider, that is where you edit records.
Lower the TTL a day early (optional)
TTL, or time to live, is how many seconds resolvers may cache a record. If you are replacing records that already exist, set their TTL to 300 (five minutes) a day before. Then your real change spreads quickly, and a mistake is quick to undo.
Add the records
Create the A or ALIAS record for the root (often shown as
@) and the CNAME forwww. Paste values exactly, with no extra spaces. If your provider adds your domain automatically, enterwww, notwww.example.com, in the name field.Remove anything that conflicts
Delete old A or AAAA records on the same names, especially ones left by a parking page or a previous host. Two records pointing at different servers means some visitors see the old site. Leave MX records untouched.
Verify, then turn on HTTPS
Wait a few minutes, then check with the commands below. Once the records resolve, your host can issue a certificate, usually automatically. Finally, pick one version (
wwwor the bare domain) and redirect the other to it.
How to check your work
Refreshing a browser tells you little, because your own device caches answers too. Ask DNS directly instead.
# Where does the bare domain point?
dig +short A example.com
# Where does www point?
dig +short CNAME www.example.com
# Is the verification record there?
dig +short TXT example.comOn Windows, nslookup -type=TXT example.com does the same job. If a public resolver still shows an old answer, Google and Cloudflare both let you flush a name from Google Public DNS or purge it from 1.1.1.1.
HTTPS is automatic now, and it has to be
Once your domain points at your host, the host proves control of it and requests a free certificate from a certificate authority such as Let’s Encrypt. You rarely see this happen. The padlock just appears.
Automation is no longer optional. The industry is shortening how long a certificate can stay valid:
Let’s Encrypt plans to go further and move from 90-day to 45-day certificates by 2028. For you, this means one thing: use a host that renews certificates for you. Nobody should be pasting certificate files into a dashboard every few weeks.
Before you call it done
FAQ
How long does it take for DNS changes to work?
Usually minutes to a few hours. Resolvers keep an old answer until its TTL runs out, so a record with a one-day TTL can take a day to update everywhere. Lowering the TTL before a change makes the switch fast.
Should I use www or the bare domain?
Either works. Pick one as the main address and redirect the other to it, so search engines see one site instead of two. Many hosts make the bare domain the default today.
Can I put a CNAME on my root domain?
Not as a plain CNAME, because the DNS rules forbid other records next to it and the root always has some. Use the A record your host gives you, or an ALIAS, ANAME or flattened CNAME if your DNS provider offers one.
Do I have to transfer my domain to my web host?
No. You can keep the domain registered where it is and only add records there. Transferring is a separate process that you only need if you want billing and DNS in one place.
Why does my site show a certificate warning?
The certificate is usually issued only after DNS points at the host. Wait until your records resolve, then check the host’s domain page. If a stale record still points at an old server, some visitors will see that server’s certificate instead.
- You connect a domain with two or three records, and your host tells you their exact values.
- Use an A or ALIAS record at the root and a CNAME for
www. - Remove conflicting records, and never delete MX records by accident.
- Check with
dig, not with a browser refresh. - Let your host handle certificates, because lifetimes keep getting shorter.
Next, see how to put a website online from start to finish, or build the site itself with AI in an afternoon.
- RFC 1034: Domain names, concepts and facilities, IETF
- RFC 8659: DNS Certification Authority Authorization (CAA) record, IETF
- Ballot SC-081v3: schedule of reducing certificate validity, CA/Browser Forum, April 2025
- Decreasing certificate lifetimes to 45 days, Let’s Encrypt, December 2025
- Flush cache, Google Public DNS
- Purge cache, Cloudflare 1.1.1.1




