XiaTools

Step-by-Step Guide to Setting Up Custom Domains on Vercel via DNS

By Rohit, founder of XiaTools · Updated 23 Oct 2026

Setting up a custom domain on Vercel connects your production deployment to your own brand identity rather than a default .vercel.app subdomain. By configuring the correct DNS records with your registrar or DNS host, you point traffic directly to Vercel's global edge network while maintaining full control over your zone file. This guide walks you through the exact process of mapping your apex domain and subdomains to Vercel securely and reliably.

Prerequisites and Understanding Vercel DNS Requirements

Before you modify any zone files, you need a Vercel project deployed and access to your domain registrar's DNS management panel. Vercel supports two primary methods for connecting custom domains: apex redirection and direct configuration. Apex domains (like example.com) typically require an A record pointing to Vercel's static IP address or a CNAME setup if your DNS provider supports flattening (ANAME/ALIAS records). Subdomains (like www.example.com or app.example.com) always use standard CNAME records.

When you add a domain inside the Vercel dashboard under your project settings, Vercel inspects your current DNS configuration and provides specific record values. Before making changes, you can verify your existing entries using the CNAME Lookup tool on XiaTools to check current mappings, identify stale records, and ensure a clean migration path without downtime.

Step-by-Step Configuration Guide

Follow these sequential steps to map your custom domain to Vercel. Note that exact menu names in registrar panels may differ slightly depending on your provider (such as Cloudflare, GoDaddy, Namecheap, or Route 53), but the underlying DNS record types remain identical.

Step 1: Add the Domain in Vercel

  1. Log in to your Vercel dashboard and navigate to your project.
  2. Click on the Settings tab at the top of the project view.
  3. In the left sidebar, click on Domains.
  4. Enter your custom domain (e.g., example.com or www.example.com) in the input field and click Add.
  5. Vercel will prompt you to choose whether you want to redirect the apex to the www subdomain or vice versa. Select your preferred canonical URL structure.

Step 2: Configure DNS Records at Your Registrar

Vercel will display the required DNS records based on the domain type you entered. Log into your domain registrar's DNS management console and add the records specified below.

For Subdomains (e.g., www.example.com):

Create a CNAME record pointing your subdomain to Vercel's global routing target.

  • Type: CNAME
  • Name / Host: www
  • Value / Target: cname.vercel-dns.com
  • TTL: Automatic or 300 seconds

For Apex Domains (e.g., example.com):

Apex domains cannot natively host a CNAME record according to DNS specifications, though many modern DNS providers offer CNAME flattening (ALIAS or ANAME). If your provider supports alias records, use the CNAME target above. Otherwise, use Vercel's provided A record.

  • Type: A
  • Name / Host: @ (or leave blank for root)
  • Value / Target: 76.76.21.21
  • TTL: Automatic or 300 seconds
Record Type Host / Name Target / Value Purpose
CNAME www cname.vercel-dns.com Routes subdomain traffic to Vercel's edge network
A @ 76.76.21.21 Points apex domain directly to Vercel static IP
TXT _vercel vc-domain-verify=example.com,abcdef... Proves domain ownership to Vercel

Step 3: Verify Domain Ownership

If your domain is currently managed by another service or if Vercel requires validation, you may need to add a TXT record for ownership verification.

  1. Copy the TXT host and value provided in the Vercel dashboard.
  2. Add a new TXT record in your DNS manager.
  3. Paste the values and save the record.

Verifying Your DNS Setup

Once your DNS records are saved, propagation can take anywhere from a few seconds to 24 hours, though most modern DNS providers update within a minute. You can verify that your records are resolving correctly using command-line tools.

Run a dig command in your terminal to check the CNAME record for your subdomain:

dig CNAME www.example.com +short

Sample output:

cname.vercel-dns.com.

To verify the A record for an apex domain, run:

nslookup example.com

Sample output:

Server:		8.8.8.8
Address:	8.8.8.8#53

Non-authoritative answer:
Name:	example.com
Address: 76.76.21.21

If you encounter SSL certificate provisioning delays, you can inspect the certificate status using OpenSSL:

openssl s_client -connect example.com:443 -servername example.com

Common Mistakes and How to Fix Them

Setting up DNS records can occasionally result in misconfigurations. Review these common pitfalls to ensure smooth operation:

  • Conflicting A Records: Leaving old A records pointing to a previous hosting provider alongside your new Vercel records causes intermittent connection errors and split traffic. Always delete obsolete A and CNAME records.
  • Cloudflare Proxy Status: If you use Cloudflare as your DNS provider, enabling the orange cloud (proxy) on your cname.vercel-dns.com record can interfere with Vercel's automated SSL certificate issuance (Let's Encrypt HTTP-01 challenges). Set the proxy status to DNS Only (grey cloud) during initial setup, or switch to Vercel's Cloudflare integration.
  • Apex CNAME Errors: Creating a standard CNAME record for an apex domain (example.com) violates DNS RFC standards and causes resolution failure at many resolvers. Use an ALIAS/ANAME record or Vercel's recommended A record instead.
  • Propagation Delays: Testing immediately after saving records can lead to false negatives due to local DNS caching. Flush your local DNS cache using ipconfig /flushdns on Windows or sudo dscacheutil -flushcache on macOS.

Quick Setup Checklist

  • Added domain to project under Vercel Settings > Domains
  • Created CNAME record for www pointing to cname.vercel-dns.com
  • Created A record for apex domain pointing to 76.76.21.21 (if applicable)
  • Added TXT verification record if requested by Vercel
  • Disabled proxying (grey cloud) on DNS provider if using Cloudflare
  • Verified record propagation using dig or nslookup
  • Confirmed automatic SSL certificate generation in Vercel dashboard

Frequently asked questions

How long does DNS propagation take when setting up a Vercel domain?

DNS propagation typically takes anywhere from a few seconds to 5 minutes with modern cloud DNS providers. However, global propagation across all international ISPs can occasionally take up to 24 hours depending on TTL settings.

Can I use Cloudflare and Vercel together for my custom domain?

Yes, you can use Cloudflare as your DNS provider while hosting on Vercel. For initial setup and SSL generation, ensure your DNS records in Cloudflare are set to 'DNS Only' (grey cloud) so Vercel can verify ownership and issue certificates.

Why is Vercel showing a 'Invalid Configuration' error for my domain?

This error usually occurs when conflicting DNS records exist, such as old A records pointing to a previous host, or when an apex domain is incorrectly assigned a standard CNAME record instead of an A record or ALIAS.

Do I need to manually configure SSL certificates for my custom domain on Vercel?

No, Vercel automatically generates, manages, and renews free SSL/TLS certificates via Let's Encrypt as soon as your domain ownership and DNS records are correctly verified.

Should I redirect my apex domain to www, or www to my apex domain?

Both approaches are valid for SEO and branding. Vercel allows you to choose your preferred canonical domain during setup and automatically configures 301 redirects for the non-preferred version.

Related articles

Free tools