Setting up a custom domain
Use this guide to add a custom domain to your Vercel project from the CLI, configure DNS records, and verify that everything is working. To do the same from the dashboard instead (Settings → Domains on your project), see Adding & Configuring a Custom Domain.
Use this block when you already know what you're doing and want the full command sequence. Replace my-site with your project name. Replace your_project_ip and your_project_cname_target with the recommended values from domain verification or your project's Settings → Domains. The vercel dns add commands apply to domains using Vercel's nameservers. For external DNS, add the records through your provider's interface.
# 1. Check your existing domains
vercel domains ls
# 2. Add the domain to your project (one arg when run from a linked project)
vercel domains add example.com
# 3. Check what DNS records are needed
vercel domains verify example.com --project my-site
# 4. Configure DNS records (apex domain)
vercel dns add example.com '@' A your_project_ip
# 4b. OR add the subdomain to your project and configure DNS records (subdomain)
vercel domains add www.example.com
vercel domains verify www.example.com --project my-site
vercel dns add example.com www CNAME your_project_cname_target
# 5. Verify DNS configuration
vercel domains verify example.com --project my-site
# If you also configured the subdomain, run:
# vercel domains verify www.example.com --project my-site
# 6. Verify SSL certificate was provisioned
vercel certs ls
# 7. Test the domain
vercel httpstat /
vercel curl /List the domains already configured on your team to avoid conflicts:
vercel domains lsThis shows all domains across your projects, including their DNS status and verification state.
Add your custom domain. From a linked project, vercel domains add takes a single argument (the domain). To target a different project (or when running outside of a linked directory), pass the project name as a second argument.
vercel domains add example.comIf the domain is already assigned to another project in your team, use the --force flag to reassign it:
vercel domains add example.com --forceFor a www subdomain, add that separately:
vercel domains add www.example.comIf you add both example.com and www.example.com, configure a redirect from one to the other in your Vercel project settings to avoid duplicate content.
After adding the domain, check its DNS configuration and any recommended changes. Replace my-site with your project name:
vercel domains verify example.com --project my-siteThe result reports DNS configuration and ownership verification status, with recommended records when DNS changes are needed. Use the record values from this result or your project's Settings → Domains. Use vercel domains inspect for domain information and project associations.
For a subdomain, run verification for the full hostname, such as vercel domains verify www.example.com --project my-site. The --project option scopes the DNS recommendations to your project.
The records you add depend on whether you're configuring an apex domain (like example.com) or a subdomain (like www.example.com).
For an apex domain, replace your_project_ip with the recommended IPv4 address and add an A record:
vercel dns add example.com '@' A your_project_ipFor a subdomain, replace your_project_cname_target with the recommended target and add a CNAME record:
vercel dns add example.com www CNAME your_project_cname_targetFor Vercel-managed DNS, confirm that Vercel lists the records you added:
vercel dns lsAfter applying the recommended records at your DNS provider, check the domain again:
vercel domains verify example.com --project my-siteThe command exits with a non-zero status when the domain is misconfigured or needs ownership verification. Follow the reported next steps, then run verification again. DNS changes can take time to propagate. Verified ownership alone does not mean the DNS configuration is valid.
Vercel automatically provisions an SSL certificate after DNS verification succeeds. Check that the certificate was issued:
vercel certs lsLook for your domain in the output. The certificate typically provisions within a few minutes of DNS verification.
Verify your domain is serving traffic correctly:
vercel httpstat /This shows a full timing breakdown for a request to your production deployment. If you need to check the response body:
vercel curl /If your domain's nameservers point to an external DNS provider (like Cloudflare or Route 53), you can't use vercel dns add to configure records. Instead:
- Add the domain to your project with
vercel domains add example.com - Run
vercel domains verify example.com --project my-site(replacemy-sitewith your project name) or open your project's Settings → Domains to get the recommended records - Add and save those records through your external DNS provider's interface
- After DNS propagation, run
vercel domains verify example.com --project my-siteagain to check configuration and ownership verification status
For a subdomain, use its full hostname in both verification commands. Use the recommended project-specific target when creating a CNAME record.
Was this helpful?