Skip to content

How to Connect Your Own Domain to Cloudflare Pages

Move a site from the default pages.dev address to your own domain. This guide covers the setup steps, DNS options, certificate wait and common mistakes.

10 min readUpdated Nov 28, 2026By XPASS Editorial Team

How to Connect Your Own Domain to Cloudflare Pages

A new site on Cloudflare Pages starts life on an address that ends in pages.dev. That is fine for testing, but it is not something you would print on a business card or ask customers to remember. Connecting your own domain gives the site a name that belongs to you, lets you carry it between hosts later, and makes email, branding and search results consistent.

This guide walks through the whole path: what you need before you begin, how to add the custom domain in the Pages project, which DNS records are involved for a subdomain compared with the bare (apex) domain, how long to wait for HTTPS, and how to fix the usual mistakes. If you have used another host before, the same ideas appear in the guides for GitHub Pages, Vercel and Notion Sites, and comparing them helps you see which parts are universal and which are specific to Cloudflare.

What "connecting a domain" actually means

Connecting a domain involves three separate pieces, and most confusion comes from mixing them up.

The first is registration: you hold the name at a registrar, and it shows up under your account there. The second is DNS: a set of records that answers the question "where should a visitor for this name go?". The third is the hosting side: the Pages project must be told that it should answer for that name and must obtain a certificate for it.

All three have to agree. If the registrar points to nameservers that do not hold your records, nothing resolves. If the records point to Pages but the project does not list the name, the visitor reaches Cloudflare and gets an error page. If the project lists the name but the records point elsewhere, the certificate never appears. When you troubleshoot, ask which of the three pieces is out of step, rather than changing things at random.

If you are still choosing a name, the domains page is the place to look at what can be registered.

Before you start

A few minutes of preparation prevents most problems:

  • Confirm that the Pages project is deployed and loads on its pages.dev address. Fix build problems first; a domain cannot make a broken deployment work.
  • Decide the main address. Many sites use www.example.com as the main name and redirect the bare example.com to it. Others do the opposite. Pick one and stay consistent.
  • Find where the domain's DNS is currently managed. At the registrar, look for the nameserver list. If the nameservers belong to your registrar, records are edited there; if they belong to another service, that is where you edit.
  • Export or write down every existing DNS record, especially MX and TXT records for email. This copy is your safety net.
  • Lower the TTL on records you plan to change, if your provider allows it, so that mistakes correct themselves quickly.

Add the custom domain in the Pages project

The steps are short, and the interface may change its labels over time, so follow the idea rather than the exact wording.

  1. Open your Cloudflare account, go to the Workers and Pages section and select the project.
  2. Open the Custom domains tab and choose to set up a custom domain.
  3. Type the name exactly as visitors will type it, for example www.example.com. Add the apex (example.com) as a second custom domain if you want both names to work.
  4. Continue and read the instructions that Pages shows. It tells you which record it expects. If the domain's DNS is already on Cloudflare, it can create the record for you; otherwise it shows the record to add at your DNS host.
  5. Confirm. The domain appears in the list with a status such as initializing, then active once DNS and the certificate are in place.

Do not add the same name to two projects, and do not leave an old project listing the name after you move the site. A name can belong to only one place at a time.

Subdomain or apex: which DNS setup applies

The difference between the two types of name is the main source of surprises, so here is a comparison.

Name type Example Typical record Where DNS must live
Subdomain www.example.com, blog.example.com CNAME to your-project.pages.dev Anywhere, including your current DNS host
Apex (bare) domain example.com Managed by Cloudflare once the zone is active On Cloudflare, so the nameservers must be changed

For a subdomain you add a CNAME whose name is just www (or blog) and whose value is the pages.dev address of your project. Many DNS dashboards append the domain automatically, so entering the full name creates a doubled name. If your DNS is already on Cloudflare, the record is created for you when you add the domain, and it is normally proxied.

For the apex, DNS standards do not allow a CNAME next to the SOA and NS records that the apex must hold. Cloudflare solves this with flattening inside its own DNS, which is why the apex normally requires the zone to be on Cloudflare. In practice this means adding the domain as a site in Cloudflare, copying the existing records it finds, checking them against your saved list, and then replacing the nameservers at the registrar with the two that Cloudflare assigns. Do this step with care, because it moves the whole domain, including email.

If you would rather not change nameservers, use a subdomain as the main address and redirect the apex to it at your registrar or DNS host, if it offers redirects.

Wait for DNS and the HTTPS certificate

After you save, two things happen in the background. DNS answers have to reach resolvers around the world, and Pages has to prove control of the name to a certificate authority and install the resulting certificate. Both are automatic.

Check progress in this order:

  1. Look up the name with a tool such as dig or an online lookup. You should see the pages.dev target for a subdomain, or Cloudflare addresses if the record is proxied.
  2. Return to the Custom domains tab and watch the status. Pending states normally clear without any action.
  3. Open the site in a private window with https at the front. A padlock with no warning means the certificate is working.
  4. Test both the www and apex versions, and also the plain http form, to confirm they all end up at your chosen address.

If something stays pending for hours, the usual cause is a record that does not match what the project expects, or a leftover record that points elsewhere. Remove the stale record, and if needed delete the custom domain from the project and add it again to trigger a fresh check.

A worked example

Imagine a small studio called Brightloom with the domain brightloom.example, registered at one company and with email hosted elsewhere. The site is a static portfolio on Cloudflare Pages at brightloom.pages.dev.

  1. The owner decides the main address will be www.brightloom.example, with the bare name redirecting to it.
  2. They save a copy of every existing DNS record. There are two MX records and three TXT records for email, plus a record for a booking service.
  3. In the Pages project they add www.brightloom.example as a custom domain. Pages says to create a CNAME from www to brightloom.pages.dev.
  4. At their current DNS host they add exactly that record, and leave the email records alone.
  5. After a few minutes the project shows the domain as active. A private window at https://www.brightloom.example loads with a padlock.
  6. For the bare name they use the redirect feature of their DNS host so that brightloom.example sends visitors to the www address.
  7. They update the sitemap, the social profile links and the contact page so that only the custom domain appears from now on.

At no point did they move nameservers, so email was never at risk. If they later want the bare domain to serve the site directly, they can plan the nameserver move as a separate, careful task.

Limits and what to watch for

  • The bare domain generally needs Cloudflare to manage the zone. Changing nameservers affects everything under the domain, so rebuild every record, especially email, before switching.
  • A CNAME at the apex is not valid in standard DNS. If a guide tells you to add one at a provider that does not support flattening, the save will fail or behave unpredictably.
  • Do not mix records for the same name that point to different hosts. Visitors will be split between them.
  • Certificates are tied to the names configured on the project. A new subdomain needs to be added to the project; a DNS record alone is not enough.
  • Pages and Workers features, build settings and project limits depend on your Cloudflare account and plan, so check the current Cloudflare documentation for what is available to you.
  • Keep the registrar account secure. Anyone who controls the registrar or the DNS can redirect your site. Turn on two-factor authentication and keep a note of who has access.
  • Renewals matter. A domain that expires stops working everywhere at once, along with email that relies on it. Keep the renewal date on a calendar.
  • Leftover records are a risk. When you retire a Pages project, remove the DNS records that point at it, so nobody else can claim the name there.

Troubleshooting

Symptom Likely cause What to do
Error page from Cloudflare on your domain The project does not list this exact name Add the name under Custom domains
Domain stays pending Record missing, doubled name or conflicting record Compare the live answer with the expected record and fix it
Certificate warning Certificate not issued yet, or a stale record Wait, then remove old records and re-add the domain
Works for you, not for others DNS still spreading, or cached answers Test from another network and wait for the TTL
Apex fails but www works Apex not set up or zone not on Cloudflare Use a redirect or move DNS to Cloudflare carefully
Email stopped after nameserver change Records were not copied Restore MX, SPF, DKIM and DMARC from your saved copy

When you look at an answer from a lookup tool, compare it character by character with the target in the project instructions. Typing mistakes, missing dots and doubled domain names account for a large share of failures.

Summary

Connecting a domain to Cloudflare Pages means getting three things to agree: the registrar, the DNS records and the Pages project. A subdomain needs a CNAME to your pages.dev address and can use any DNS host. The bare domain normally needs the zone to be managed on Cloudflare, which means changing nameservers after you have copied every existing record. Pages issues and renews the HTTPS certificate on its own once the name is listed and DNS is right. Save your old records, choose one canonical address, and test in a private window. When you are ready to pick a name or look after email for it, the domains page and the business email page are good places to continue.

Frequently asked questions

Can I use a domain I bought somewhere else with Cloudflare Pages?

Yes. A domain registered with any registrar can be used. For a subdomain such as www you can keep your existing DNS host and add a CNAME. For the apex domain, Pages normally expects the domain's DNS to be managed on Cloudflare, so you change the nameservers at your registrar.

Do I need to buy a separate certificate for HTTPS?

No. Pages issues and renews a certificate for the custom domain automatically once the DNS is correct. A separate certificate is only needed for other services that you run yourself.

How long does it take for the domain to start working?

Often a few minutes, but DNS changes can take longer to spread, and the certificate may need extra time after that. Plan for up to a few hours before you decide something is wrong.

Will connecting the domain break my email?

Not if you leave the MX, SPF, DKIM and DMARC records untouched. The risk comes from moving nameservers without copying every existing record first.

Should I keep the pages.dev address after adding my domain?

It keeps working, so decide which address is canonical. Link, share and put in your sitemap only the custom domain, and consider redirecting the default address so search engines see one version.

About the author

Bob Kanokphon Thongdee, founder of XPASS VPN

Bob Kanokphon Thongdee

  • Founder of XPASS VPN
  • Co-founder of eSIMonline.asia
  • More than 7 years in online marketing
  • Founder of Cojourney Visa and Cojourney Travel

Start your website the right way

Register a domain, add SSL and set up business email from one place.

.com registration from $18.81 for the first year

Start with a domain

Keep reading

Website Guides

How to Connect Your Own Domain to GitHub Pages

A practical walkthrough for pointing a domain you own at a GitHub Pages site, covering apex and www setups, DNS records, verification and common mistakes.

10 min read

Website Guides

How to Connect Your Own Domain to Vercel

A calm, step-by-step walk through adding a custom domain to a Vercel project, choosing DNS records, and confirming that the certificate and redirects work.

10 min read

Website Guides

How to Connect a Custom Domain to Notion Sites

Turn a published Notion page into a site on your own address. Learn which DNS record to add, how verification works and what to check afterwards.

9 min read