← Back to Blog Web Development

Custom Domain on Vercel: Step-by-Step

Last Rev Team Aug 28, 2023 8 min read
DNS configuration flow diagram showing domain pointing to Vercel edge network with SSL certificate layers

You have built your site. It works great on your-project.vercel.app. Now you want it on yourbrand.com. This should be simple, and mostly it is... but DNS configuration has a way of making straightforward things confusing.

Here is the complete process, including the parts that the docs assume you already know.

Before You Start

You need three things:

  1. A Vercel project with a successful deployment. If your site is not deploying correctly on the .vercel.app domain, fix that first. Adding a custom domain will not solve build or deployment issues.
  2. A domain you own. You can buy one through Vercel (they act as a registrar) or use any domain registrar... Namecheap, Google Domains, Cloudflare, GoDaddy, whoever you bought it from.
  3. Access to your DNS settings. You need to be able to add or modify DNS records at your registrar or DNS provider. If someone else manages your DNS, loop them in now.

Adding the Domain in Vercel

Start in the Vercel dashboard. Go to your project, then Settings, then Domains. Type in your domain and click Add.

Vercel will show you the DNS records you need to create. There are two approaches, and which one you use depends on whether you are configuring a root domain (yourbrand.com) or a subdomain (www.yourbrand.com).

For Subdomains (www.yourbrand.com)

Create a CNAME record pointing to cname.vercel-dns.com. This is the straightforward case.

  • Type: CNAME
  • Name: www (or whatever subdomain you want)
  • Value: cname.vercel-dns.com

CNAME records work reliably for subdomains because the DNS specification explicitly supports them. This is the simplest configuration.

For Root Domains (yourbrand.com)

Root domains (also called "apex" or "naked" domains) are trickier. The DNS specification says you cannot have a CNAME record on a root domain because it conflicts with other record types (like MX records for email). Some DNS providers work around this with proprietary record types:

  • ALIAS records (supported by DNSimple, DNS Made Easy)
  • ANAME records (supported by some providers)
  • Flattened CNAME (Cloudflare does this automatically)

If your DNS provider supports one of these, point it at cname.vercel-dns.com. If not, use an A record pointing to Vercel's IP address: 76.76.21.21.

  • Type: A
  • Name: @ (represents the root domain)
  • Value: 76.76.21.21

The downside of A records is that they point to a specific IP address, which is less resilient than a CNAME that resolves dynamically. But for most sites, this works fine.

Recommended: Set Up Both Root and WWW

Best practice is to add both yourbrand.com and www.yourbrand.com to your Vercel project. Vercel will automatically configure one to redirect to the other (you choose which is the primary).

This matters for two reasons:

  • User expectations: Some visitors type www.yourbrand.com and some type yourbrand.com. Both should work.
  • SEO: Google treats www and non-www as separate sites. Having one redirect to the other consolidates your search authority on a single domain.

SSL Certificates: Automatic

One of the best things about Vercel's domain setup is that SSL certificates are fully automatic. Once your DNS records are pointing to Vercel, the platform provisions a free SSL certificate from Let's Encrypt. No manual configuration. No certificate renewals to manage. No HTTPS setup at all.

The certificate covers both your root domain and any subdomains you have configured. HTTPS is enforced by default... HTTP requests are automatically redirected to HTTPS. This is the correct behavior, and the fact that Vercel handles it without any configuration is genuinely great.

DNS Propagation: The Waiting Game

After you create your DNS records, they need to propagate across the global DNS system. This can take anywhere from a few minutes to 48 hours, though in practice most changes propagate within an hour.

During propagation, some visitors might see your site on the custom domain while others see an error. This is normal. Do not panic. Do not change your DNS records because it "is not working yet." Every change resets the propagation clock.

To check propagation status, use a tool like whatsmydns.net to see how your DNS records look from different locations around the world. When most locations show the correct record, you are good.

If your domain is not resolving after 24 hours, double-check:

  • You created the right record type (CNAME for subdomains, A or ALIAS for root)
  • You pointed to the correct value (cname.vercel-dns.com or 76.76.21.21)
  • There are no conflicting records on the same name
  • Your registrar's nameservers are configured correctly

Common Issues and How to Fix Them

"Domain is already in use"

If Vercel says the domain is already added to another project, it means someone (maybe you on a different account, maybe a previous team member) already configured this domain on Vercel. You will need to remove it from the other project first, or contact Vercel support if you cannot access that project.

SSL Certificate Not Provisioning

The SSL certificate will not provision until DNS is pointing to Vercel. If the certificate is stuck in a "pending" state, it usually means DNS propagation is not complete yet. Wait longer. If it has been more than 48 hours, check that you do not have CAA records in your DNS that restrict which certificate authorities can issue certificates for your domain.

Email Stops Working After DNS Changes

This is a common and preventable disaster. If you change your domain's nameservers to Vercel (instead of just adding individual records at your existing DNS provider), you may lose your MX records that route email. Before making any nameserver changes, document every existing DNS record and recreate them at the new provider.

Better yet, do not change nameservers at all. Just add the specific A and CNAME records Vercel needs at your existing DNS provider. This preserves all your other DNS records.

Redirect Loops

If you are using Cloudflare as your DNS provider with their proxy enabled (orange cloud icon), you may encounter redirect loops. Cloudflare's SSL settings can conflict with Vercel's automatic HTTPS. The fix is either to use Cloudflare in "DNS only" mode (grey cloud) or set Cloudflare's SSL mode to "Full (strict)."

Using Vercel as Your Registrar

Vercel also acts as a domain registrar, meaning you can buy domains directly through them. The advantage is zero configuration... domains purchased through Vercel are automatically configured with the right DNS records. No separate registrar dashboard to manage.

The pricing is competitive with other registrars. For new projects where you do not already own a domain, buying through Vercel removes one layer of configuration entirely. For existing domains, transferring to Vercel as registrar is an option but not required.

After Your Domain Is Live

Once your custom domain is working, a few things to verify:

  • Test both www and non-www. Both should either work or redirect properly.
  • Test HTTPS. Navigate to http://yourbrand.com and confirm it redirects to https://yourbrand.com.
  • Update your analytics. If you are using Google Analytics, Search Console, or similar tools, update them with your custom domain.
  • Update your sitemap. Make sure your sitemap references the custom domain, not the .vercel.app URL.
  • Test deploy previews. New deploys should generate preview URLs on the .vercel.app domain. Your custom domain should always point to your production deployment.

Setting up a custom domain is one of those tasks that is either trivially easy or frustratingly confusing, with no middle ground. The key is understanding what DNS records to create and then being patient while they propagate. Once it is configured correctly, Vercel handles SSL, routing, and CDN distribution automatically.

If you are running into domain or deployment issues, reach out and we can help troubleshoot.

Sources

  1. Vercel Documentation -- "Domains" (2023)
  2. Vercel Documentation -- "Encryption and SSL" (2023)
  3. whatsmydns.net -- DNS Propagation Checker