× press ESC to close

Netlify builds, deploys, and hosts your front end.

Overview

You can use your own domain for a Netlify site for free.

A domain name is the URL or web address where visitors find your site.

By default, any site on Netlify is accessible via its Netlify subdomain, which has the form [name-of-your-site].netlify.com. For example, you would access a site named warrior-priscilla-50207 with warrior-priscilla-50207.netlify.com.

To make a site accessible via one or more non-Netlify domain names (eg. www.yourcustomdomain.com), you must add custom domain(s) to your site as described below.

General steps:

  1. If you don‘t already own a custom domain, buy one with a domain registration service.
  2. Add the custom domain to your site.
  3. Configure your DNS provider to point the domain at the Netlify servers.
  4. Test that your site is accessible via the custom domain. There may be a delay while DNS changes propagate.

Definitions

  • Domain name (or domain for short): full name used to access a site. For example, yoursitename.netlify.com or www.yourcustomdomain.com
  • Root domain (also known as naked, bare, or apex domain): the yourcustomdomain.com part in www.yourcustomdomain.com.
  • Subdomain: a domain that is part of a larger domain; the only domain that is not also a subdomain is the root domain. For example, www.yourcustomdomain.com and app.yourcustomdomain.com are subdomains of yourcustomdomain.com.
  • Netlify subdomain: Netlify term for the default domain with the form [name-of-your-site].netlify.com given to each site.
  • Custom domain: a non-Netlify domain assigned to a site.
  • Primary domain: Netlify term for the main custom domain assigned to a site.
  • Domain alias: Netlify term for additional custom domains assigned to a site.
  • Domain registrar (or domain registration service): company that lets your buy and register a domain name.
  • DNS provider: company that maintains the DNS servers that translate a domain name to a destination.
  • Nameserver (or DNS server): specialized server that translates domain names into IP addresses.
  • DNS zone: provides information about one or more domain names. Each zone contains a list of DNS records with mappings between domain names and IP addresses.

Assigning a custom domain

You can assign a custom domain to your site through:

  • the CLI tool, using the netlify update command, or
  • the Custom domains panel in the web UI.

To add a custom domain via the web UI, go to your site’s Settings › Domain Management section.

The Custom domains panel lists all the domains linked to your site. By default, the only domain listed is the Netlify subdomain assigned to your site based on the site’s name.

You can change the default Netlify subdomain by clicking the options button represented with a icon next to the subdomain, and selecting Edit site name in the dropdown.

To add a custom domain, click Add custom domain at the bottom of the Custom domains panel, and enter your domain name.

Assigning a root domain or a www subdomain

When you add a root domain (eg. yourcustomdomain.com) or a www subdomain (eg. www.yourcustomdomain.com) to your site, two entries are added to the Custom domains panel:

  • one entry for the root domain, and
  • one entry for the www subdomain.

The primary domain is the custom domain you entered. The other entry is for the alternative domain that gets redirected automatically to the primary domain.

  • If you set the www subdomain as your primary domain, Netlify will automatically redirect the root domain to the www subdomain.
  • If you set the root domain as your primary domain, Netlify will automatically redirect the www subdomain to the root domain.

Unless your DNS provider supports CNAME flattening, ANAME or ALIAS records for root domains, we strongly recommend setting the www subdomain as your primary domain. Our “To WWW or Not WWW” article has more details on why we recommend that configuration.

Assigning a non-www subdomain

If you set a subdomain other than www as your primary domain (eg. app.yourcustomdomain.com), only one entry will be added to the list of custom domains assigned to your site.

DNS configuration

After you add a custom domain to a site, the domain name will normally appear grayed out in the Custom domains panel, with a Check DNS configuration link next to it. This means Netlify cannot serve your site correctly under that domain.

To serve your site under a custom domain, you need to point DNS records for the domain at the Netlify servers.

Click Check DNS configuration next to the custom domain to see customized instructions on the DNS records you need to configure. The instructions will vary depending on whether:

You can also choose to use Netlify as your DNS provider.

Depending on your DNS provider, changes to DNS records can take several hours to propagate and take effect for the entire internet.

Automatic DNS configuration

Netlify offers the option to handle DNS management for you. This enables advanced subdomain automation and deployment features, and ensures that your site uses our CDN for the root domain as well as for subdomains like www.

After adding a custom domain to your site in the Custom domains panel, click the options button represented with a icon next to your primary domain, and select Set up Netlify DNS in the dropdown. This will open a 3-step flow to move your DNS traffic to Netlify:

Step 1. Confirm that you want to add your domain to Netlify by creating a DNS zone for the domain – the DNS zone will contain all of the DNS records for that domain. This step won’t change how we serve your site. Your DNS traffic will only be served by Netlify once you complete all 3 steps.

Step 2. Netlify will create the DNS records required for your Netlify site automatically. We are happy to support DNS for all records in your domain including ones that don’t point to our service; if you’re using your domain for other services, like email, you will need to add all other records like MX, etc, in this step. (And, if you need SRV records here - please contact support to get them installed)

Step 3. Make note of the four nameservers assigned to your new DNS zone – they may vary for every DNS zone you create. Go to your domain registrar and change your nameservers to point at your new Netlify DNS zone.

It can take some time for the nameserver change to propagate, but once this is done you’re all set.

Manual DNS configuration for root and www custom domains

If you’re not using Netlify’s managed DNS, you’ll have to manually configure the DNS records for your domain with your existing DNS provider.

If you set a root domain, like yourcustomdomain.com, or a www subdomain, like www.yourcustomdomain.com, as your custom domain, you’ll want to set up two records at your DNS provider –one for the root domain, and one for the www subdomain– so that people who type either one in can end up at your website, and so that our automatic domain redirects work.

The recommended way to point your custom domain to our servers is by creating a CNAME record in your DNS configuration for your www subdomain. This record will be an alias to your site’s subdomain on Netlify.

For instance, if my domain is mycustomdomain.com and my Netlify sitename is mysitename, I would create a CNAME record for www pointing www.mycustomdomain.com to mysitename.netlify.com.

To point the root domain at our servers, there are two options:

  1. Recommended: Use a DNS provider that supports CNAME flattening, ANAME or ALIAS records for root domains, and alias your root domain to [your-site-name].netlify.com. We recommend using NS1, or Netlify’s built-in DNS for this purpose.
  2. Alternative: Create an A record pointing your root domain to our load balancer’s IP address 104.198.14.52.

The screenshot below shows an example of Godaddy’s DNS record panel with the DNS records required to point a custom domain at a site called mysitename.

Example of DNS configuration in Godaddy's DNS record panel

Manual DNS configuration for non-www custom domains

If you are planning to set your site’s custom domain to a non-www subdomain, like blog.yourdomain.com, most of the above instructions won’t be as applicable to you. The things to make sure of are:

  1. You should use a CNAME DNS record for that subdomain to point to your [your-site-name].netlify.com so you can use the CDN.
  2. You don’t need a www.subdomain.yourdomain.com DNS entry.
  3. You probably want to stick with your external DNS host. If you use Netlify DNS, you’ll be hosting yourdomain.com with us, not subdomain.yourdomain.com. Netlify DNS can only manage entire DNS zones for root domains.

Branch Subdomains

* Only available in our UI with Netlify DNS

Netlify DNS can automatically turn your deployed branches into their own subdomains.

For example: If you have a branch named staging, and your site’s custom domain is example.com, you can view it at staging.example.com. Use the New subdomain button to select a branch and create a subdomain for that branch.

Branch subdomains panel with no branch subdomains selected yet

A subdomain can be deleted by clicking the x button in the corresponding subdomain row.

Branch subdomains panel with one branch subdomain

If you need to set up branch subdomains without us managing your DNS, please contact support.

Naked domains?

You can use naked domains with Netlify, but we recommend you always use the www version of the domain (eg. www.example.com) for your site. This makes it easier to take advantage of Netlify’s powerful CDN.

If you prefer the naked domain, we recommend you use a DNS provider that supports CNAME flattening, ANAME or ALIAS records for apex domains such as Cloudflare, NS1, or Netlify’s built-in DNS.

If you instead set an A record for the apex domain, you won’t be able to take advantage of the full Netlify CDN. If your provider lets you set an ALIAS, the full CDN will work. If not, when you serve from your apex domain with an A record, your assets (Javascript, CSS, images) may be served out of a global CDN depending on your deployment settings, but your HTML will be served out of our primary datacenter in the US.

Domain redirects

We’ll automatically set up redirects for the alternative domain to the primary domain. So if you use www.example.com, we’ll configure example.com to do a 301 redirect to the www domain. If you assign the root domain to your site, we’ll redirect in the opposite direction.

We only redirect automatically between the root domain and www. Not any other subdomains. You can configure other hostname redirection yourself as described in this article.

Domain aliases

You can add additional custom domains to your site so the same site will be rendered on several different domains. You can use domain aliases together with rewrite and redirect rules to redirect or rewrite based on the hostname entered into the browser by your visitors.


Notice something is incorrect or outdated?

First off, great eye! We appreciate your discovery and want to ensure it gets addressed immediately. Please let us know here.

Want to get started quick?